From 6e4624a0d756553a71ef203a7629a505b579e4d6 Mon Sep 17 00:00:00 2001 From: Dirk Sohler Date: Mon, 30 Jan 2017 03:04:43 +0100 Subject: [PATCH] Add wall-mounted sign --- init.lua | 69 ++++++++++++++++++------- textures/craftguide_sign.png | Bin 0 -> 3360 bytes textures/craftguide_sign_inventory.png | Bin 0 -> 3283 bytes 3 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 textures/craftguide_sign.png create mode 100644 textures/craftguide_sign_inventory.png diff --git a/init.lua b/init.lua index 548c460..bdf1607 100644 --- a/init.lua +++ b/init.lua @@ -378,31 +378,57 @@ 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", wield_image = "craftguide_book.png", stack_max = 1, groups = {book=1}, - on_use = function(itemstack, user) - if not datas.init_items then - craftguide:get_init_items() - end + on_use = function(itemstack, user) 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 - end +mt.register_node("craftguide:sign", { + description = "Crafting Guide Sign", + drawtype = "nodebox", + tiles = {"craftguide_sign.png"}, + inventory_image = "craftguide_sign_inventory.png", + wield_image = "craftguide_sign_inventory.png", + stack_max = 1, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + groups = {wood = 1, oddly_breakable_by_hand = 1, flammable = 3}, + legacy_wallmounted = true, + 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_rightclick = function(pos, node, user, itemstack, pointed_thing) + craftguide:on_use(itemstack, user) + end }) mt.register_craft({ @@ -417,5 +443,12 @@ mt.register_craft({ burntime = 3 }) +mt.register_craft({ + output = "craftguide:sign", + type = "shapeless", + recipe = {"default:sign_wall_wood"} +}) + + 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..dbd4cec7f2c2751b187fc3fbcf700a18ba9b08b8 GIT binary patch literal 3360 zcmV+*4d3#KP)uJ@VVD_UC<6{NG_fI~0ue<-1QkJoA_k0xBC#Thg@9ne9*`iQ#9$Or zQF$}6R&?d%y_c8YA7_1QpS|}zXYYO1x&V;8{kgn!SPFnNo`4_X6{c}T{8k*B#$jdxfFg<9uYy1K45IaYvHg`_dOZM)Sy63ve6hvv z1)yUy0P^?0*fb9UASvow`@mQCp^4`uNg&9uGcn1|&Nk+9SjOUl{-OWr@Hh0;_l(8q z{wNRKos+;6rV8ldy0Owz(}jF`W(JeRp&R{qi2rfmU!TJ;gp(Kmm5I1s5m_f-n#TRsj}B0%?E`vOzxB2#P=n*a3EfYETOrKoe*ICqM@{4K9Go;5xVgZi5G4 z1dM~{UdP6d+Yd3o?MrAqM0Kc|iV92owdyL5UC#5<>aVCa44|hpM4E zs0sQWIt5*Tu0n&*J!lk~f_{hI!w5`*sjxDv4V%CW*ah~3!{C*0BD@;TgA3v9a1~q+ zAA{TB3-ERLHar49hi4Ih5D^-ph8Q6X#0?2VqLBoIkE}zAkxHZUgRb+f=nat zP#6>iMMoK->`~sRLq)(kHo*Vn{;LcG6+edD1=7D>9j^O?D{Qg|tCDK{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&swrA8dGtepviS>QUumrN{L@ z>;2q1Vm)$Z)P1z?N$8UYW2~{~zhwUMVZ87u`Dx{Z>O|9|`Q+&->FRy-Sjp7DHs zy69KwU-!MxeeuI@&cF4|M9z%AfP?@5 z`Tzg`fam}Kbua(`>RI+y?e7jT@qQ9J+u00v@9M??Vs0RI60puMM)00009a7bBm z000XU000XU0RWnu7ytkO2XskIMF-&l9sw^Q!`&&L0006jNklCWg zf~FS+=@pfByHkwY^9bTTpSC`eljFHQQIepAo{yraWKqJ{*f7stzByoAS>Ha$U%c7^ zVBvZb!?LK^$8a16t=^~uP_qs8e(bT>nxebgWp!hRJ6A@j8iJMeZCV$Hsb~Vf=i>KV z0@p>#6t&ZFiW?|bD3w%t?H+oiK#)mFoD{i=LgQouy)4knf+$H4qJ*;4n#}t_!uaq2 zah9<5_S-*KcWY{dI7`_4?oc(X!o+%`&gs!p?C$;I!PRpt%uW=%vlBeL)&$`0rL!!y zruh1^jjn1)nHH1zfuz%MXt%qJ3=Lur*f`z7d3WC-2ztdv$^zH*7#SL*exi;LC3Iay zS)QNH^DLqtBmkIolQfd(MiqcGP03^*RGqkAT&-0ziQ|ko3gPiw^T@xjJU^YQhGic4 q7t*+ovN$)Mn^kdWgeVFL`;yI+0000Sp%< literal 0 HcmV?d00001 diff --git a/textures/craftguide_sign_inventory.png b/textures/craftguide_sign_inventory.png new file mode 100644 index 0000000000000000000000000000000000000000..649f4054291c3c23774dfbac49459bcc5652293d GIT binary patch literal 3283 zcmV;^3@r1BP)uJ@VVD_UC<6{NG_fI~0ue<-1QkJoA_k0xBC#Thg@9ne9*`iQ#9$Or zQF$}6R&?d%y_c8YA7_1QpS|}zXYYO1x&V;8{kgn!SPFnNo`4_X6{c}T{8k*B#$jdxfFg<9uYy1K45IaYvHg`_dOZM)Sy63ve6hvv z1)yUy0P^?0*fb9UASvow`@mQCp^4`uNg&9uGcn1|&Nk+9SjOUl{-OWr@Hh0;_l(8q z{wNRKos+;6rV8ldy0Owz(}jF`W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