From 9c8f3fb0d9d700aecffd650c941e2ea343750154 Mon Sep 17 00:00:00 2001 From: Dirk Sohler Date: Mon, 30 Jan 2017 05:24:03 +0100 Subject: [PATCH] Add wall-mounted sign --- init.lua | 73 ++++++++++++++++++++++++------- textures/craftguide_sign.png | Bin 0 -> 685 bytes textures/craftguide_sign_inv.png | Bin 0 -> 685 bytes 3 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 textures/craftguide_sign.png create mode 100644 textures/craftguide_sign_inv.png diff --git a/init.lua b/init.lua index 548c460..5922098 100644 --- a/init.lua +++ b/init.lua @@ -378,6 +378,26 @@ mt.register_on_player_receive_fields(function(player, formname, fields) end end) +function craftguide:on_use(itemstack, user) + if not datas.init_items then + craftguide:get_init_items() + end + + local player_name = user:get_player_name() + local data = datas[player_name] + + if progressive_mode or not data then + datas[player_name] = {filter="", pagenum=1, iX=9} + if progressive_mode then + craftguide:get_filter_items( + datas[player_name], user) + end + craftguide:get_formspec(player_name) + else + show_formspec(player_name, "craftguide", data.formspec) + end +end + mt.register_craftitem("craftguide:book", { description = "Crafting Guide", inventory_image = "craftguide_book.png", @@ -385,23 +405,32 @@ mt.register_craftitem("craftguide:book", { stack_max = 1, groups = {book=1}, on_use = function(itemstack, user) - if not datas.init_items then - craftguide:get_init_items() - end + craftguide:on_use(itemstack, user) + end +}) - local player_name = user:get_player_name() - local data = datas[player_name] - - if progressive_mode or not data then - datas[player_name] = {filter="", pagenum=1, iX=9} - if progressive_mode then - craftguide:get_filter_items( - datas[player_name], user) - end - craftguide:get_formspec(player_name) - else - show_formspec(player_name, "craftguide", data.formspec) - end +mt.register_node("craftguide:sign", { + description = "Crafting Guide Sign", + drawtype = "nodebox", + tiles = {"craftguide_sign.png"}, + inventory_image = "craftguide_sign_inv.png", + wield_image = "craftguide_sign_inv.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + groups = {wood=1, oddly_breakable_by_hand=1, flammable=3}, + node_box = { + type = "wallmounted", + wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, + wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}, + wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375} + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Crafting Guide Sign") + end, + on_rightclick = function(pos, node, user, itemstack) + craftguide:on_use(itemstack, user) end }) @@ -417,5 +446,17 @@ mt.register_craft({ burntime = 3 }) +mt.register_craft({ + output = "craftguide:sign", + type = "shapeless", + recipe = {"default:sign_wall_wood"} +}) + +mt.register_craft({ + type = "fuel", + recipe = "craftguide:sign", + burntime = 10 +}) + mt.register_alias("xdecor:crafting_guide", "craftguide:book") diff --git a/textures/craftguide_sign.png b/textures/craftguide_sign.png new file mode 100644 index 0000000000000000000000000000000000000000..f64b5ab5a67db1501315eefd08a6dc32e685074a GIT binary patch literal 685 zcmV;e0#f~nP)u`(b8u~SrnpcXd%2Nr^;g&=l<3W|lD zgcw6miv(0eMXYTEEsTXIq9n%6?d{I({IW=8X#{Zrl z96FaMtuu5gIWTpQG?la>k~&G0;9L8T7otZffwP`>uU}&tgODitwV}IhJ1d`7=ygX( zGL5$ml_|X63|r-qGU3a|&&X7vqCfuUm~QoOfhx}Ycu zs`3Yu2c|G}gU2!2>mjsG>6aygauq+Uc(FLg>i4faTbM<6I=oqWN;9ZOZT9 zU>Pkm$^C0*;?O#do;u4$xsLQh#&+za9#rJH##)Q+blCXy4KH)XdfV{9^YZaLL(?Mq zWr;+ww*H-!4$33Q8b_U#`> z2t!jtQ>|l%8w3|H)mNMj0xz^OCWkf4T z9IXw2B1VS`0xgrx0*T`M_4zHaaPz{EC|nY@%))4|M{?uhOjL>b@A)!~v^MY;+U7YU TT%RJG00000NkvXXu0mjfIIb+U literal 0 HcmV?d00001 diff --git a/textures/craftguide_sign_inv.png b/textures/craftguide_sign_inv.png new file mode 100644 index 0000000000000000000000000000000000000000..61372344bbb71a1af0164333415bb90d750bb609 GIT binary patch literal 685 zcmV;e0#f~nP)=-)$~AB+*Jl5G-ucSQ!w4*eNPOPzxLX0}DaaLJ&Ja1;xTn zLX07(MFJ|KBGxv77REvpQ4-_k_IBUx`&f%qmS)O<8K(G+xPAEqX(9hbs@A=VV zG9|PzDJD@Im^w(3C>q(4ctxuqH0~cSwgIUn-UZ&hevPdyQlaTrmhQIgtbAIb*BwEm zhTuFp)r7Dab~>Px;LFF)s6?Y%iHr^%LPIz2(8iX%lanBF#<%CJuSv8{2*Ht>oIKAd ziyurLn8H>y0ncc!hcqUkUla_ARl>03#o`>R-@o!~VHVTr@Mh^L^`PY8y;~qha7{y! zWmwx#RyDF;S)xoB=}n-rE{A7M^XmB$(=#Vno`1m9p=n+$&T;toFCC2``6AebiO@$>MR?@Iw}kq+p&{sP?BW^=NzWfVdK{~g31`{Z6n0M%g6H!Z6jpA zC{SqD*1xmz;RAul@1NfYJ`meT^czSiNyjEoO7Z^PTk64pvZ_%k-Q>WFNH-s6-~Mr= zwA2;U+@nODBrwr1nEWG@)t&XJ;aTRGiagzd%j9q8W;Hsgqk%d TEQ3u-00000NkvXXu0mjfIe;*O literal 0 HcmV?d00001