From 8de8a271d17061a71600798d257d5f7346fce0a1 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 1 Apr 2015 11:13:07 +0100 Subject: [PATCH] updated to work with 0.4.12 --- README.md | 1 + init.lua | 55 +++++++++----------- textures/door_brown.png | Bin 127 -> 0 bytes textures/door_grey.png | Bin 115 -> 0 bytes textures/door_steel.png | Bin 132 -> 0 bytes textures/door_steel_a.png | Bin 449 -> 0 bytes textures/door_steel_b.png | Bin 461 -> 0 bytes textures/door_wood.png | Bin 130 -> 0 bytes textures/door_wood_a.png | Bin 555 -> 0 bytes textures/door_wood_b.png | Bin 539 -> 0 bytes textures/moreblocks_circle_stone_bricks.png | Bin 0 -> 267 bytes textures/protector_logo.png | Bin 179 -> 138 bytes textures/protector_side.png | Bin 256 -> 0 bytes textures/protector_top.png | Bin 272 -> 0 bytes 14 files changed, 27 insertions(+), 29 deletions(-) delete mode 100644 textures/door_brown.png delete mode 100644 textures/door_grey.png delete mode 100644 textures/door_steel.png delete mode 100644 textures/door_steel_a.png delete mode 100644 textures/door_steel_b.png delete mode 100644 textures/door_wood.png delete mode 100644 textures/door_wood_a.png delete mode 100644 textures/door_wood_b.png create mode 100644 textures/moreblocks_circle_stone_bricks.png delete mode 100644 textures/protector_side.png delete mode 100644 textures/protector_top.png diff --git a/README.md b/README.md index b731cf8..303740c 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,4 @@ Released under WTFPL 0.5 - Added protector.radius variable in init.lua (default: 5) 0.6 - Added Protected Doors (wood and steel) and Protected Chest 0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy contents across, also chests can be named +0.8 - Updated to work with Minetest 0.4.12, simplified textures \ No newline at end of file diff --git a/init.lua b/init.lua index 1ff71d8..61aecc5 100644 --- a/init.lua +++ b/init.lua @@ -176,7 +176,7 @@ end minetest.register_node("protector:protect", { description = "Protection Block", - tiles = {"protector_top.png","protector_top.png","protector_side.png"}, + tiles = {"moreblocks_circle_stone_bricks.png","moreblocks_circle_stone_bricks.png","moreblocks_circle_stone_bricks.png^protector_logo.png"}, sounds = default.node_sound_stone_defaults(), groups = {dig_immediate=2}, drawtype = "nodebox", @@ -401,11 +401,11 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) pos.y = pos.y-dir minetest.swap_node(pos, {name=replace, param2=p2}) - local snd_1 = "door_close" - local snd_2 = "door_open" + local snd_1 = "doors_door_close" + local snd_2 = "doors_door_open" if params[1] == 3 then - snd_1 = "door_open" - snd_2 = "door_close" + snd_1 = "doors_door_open" + snd_2 = "doors_door_close" end if minetest.get_meta(pos):get_int("right") ~= 0 then @@ -421,10 +421,10 @@ local name = "protector:door_wood" doors.register_door(name, { description = "Protected Wooden Door", - inventory_image = "door_wood.png^protector_logo.png", + inventory_image = "doors_wood.png^protector_logo.png", groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1}, - tiles_bottom = {"door_wood_b.png^protector_logo.png", "door_brown.png"}, - tiles_top = {"door_wood_a.png", "door_brown.png"}, + tiles_bottom = {"doors_wood_b.png^protector_logo.png", "doors_brown.png"}, + tiles_top = {"doors_wood_a.png", "doors_brown.png"}, sounds = default.node_sound_wood_defaults(), sunlight = false, }) @@ -483,10 +483,10 @@ local name = "protector:door_steel" doors.register_door(name, { description = "Protected Steel Door", - inventory_image = "door_steel.png^protector_logo.png", + inventory_image = "doors_steel.png^protector_logo.png", groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1}, - tiles_bottom = {"door_steel_b.png^protector_logo.png", "door_grey.png"}, - tiles_top = {"door_steel_a.png", "door_grey.png"}, + tiles_bottom = {"doors_steel_b.png^protector_logo.png", "doors_grey.png"}, + tiles_top = {"doors_steel_a.png", "doors_grey.png"}, sounds = default.node_sound_wood_defaults(), sunlight = false, }) @@ -539,23 +539,6 @@ minetest.register_craft({ } }) -local function get_locked_chest_formspec(pos) - local spos = pos.x .. "," .. pos.y .. "," ..pos.z - local formspec = - "size[8,9]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. - "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]".. - "button[0,4.5;2,0.25;toup;To Chest]".. - "field[2.3,4.8;4,0.25;chestname;;]".. - "button[6,4.5;2,0.25;todn;To Inventory]".. - "list[current_player;main;0,5;8,1;]".. - "list[current_player;main;0,6.08;8,3;8]".. - default.get_hotbar_bg(0,5) - return formspec -end - -- Protected Chest minetest.register_node("protector:chest", { @@ -570,6 +553,7 @@ minetest.register_node("protector:chest", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Protected Chest") + meta:set_string("name", "") local inv = meta:get_inventory() inv:set_size("main", 8*4) end, @@ -602,10 +586,22 @@ minetest.register_node("protector:chest", { on_rightclick = function(pos, node, clicker) local meta = minetest.get_meta(pos) if not minetest.is_protected(pos, clicker:get_player_name()) then + + local spos = pos.x .. "," .. pos.y .. "," ..pos.z + local formspec = "size[8,9]".. + default.gui_bg..default.gui_bg_img..default.gui_slots.. + "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]".. + "button[0,4.5;2,0.25;toup;To Chest]".. + "field[2.3,4.8;4,0.25;chestname;;"..meta:get_string("name").."]".. + "button[6,4.5;2,0.25;todn;To Inventory]".. + "list[current_player;main;0,5;8,1;]".. + "list[current_player;main;0,6.08;8,3;8]".. + default.get_hotbar_bg(0,5) + minetest.show_formspec( clicker:get_player_name(), "protector:chest_"..minetest.pos_to_string(pos), - get_locked_chest_formspec(pos) + formspec ) end end, @@ -654,6 +650,7 @@ minetest.register_on_player_receive_fields(function(player,formname,fields) -- change chest infotext to display name if fields.chestname ~= "" then + meta:set_string("name", fields.chestname) meta:set_string("infotext", "Protected Chest ("..fields.chestname..")") else meta:set_string("infotext", "Protected Chest") diff --git a/textures/door_brown.png b/textures/door_brown.png deleted file mode 100644 index 77f748d8543c5f0da92f09e277d449a6507f2bb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 127 zcmeAS@N?(olHy`uVBq!ia0vp^j6f{F!3HF+&llYeq})7R978x}`kp+<+n^xedhmSo z0g3Dlg4G-TTlsJV9@dMS`}&2=x06@%Hj23Dx;hB0wO5K3N>jVzT;a2E?brQ>m#>ig c*mr^5u|aI<9C5>4Koc1}UHx3vIVCg!06s`7YybcN diff --git a/textures/door_grey.png b/textures/door_grey.png deleted file mode 100644 index 13665d2060dd8f1e5a7bc37e8ee47689412898d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^j6f{F!3HF+&llYeq^vw$978x}>K-u^I-tP8aPYB2 z?f&iCpUyFMV<|Ha6MeULZpSQsmsHVJ3`L(^H78(65=}0G2vKBth0FH; z_P1rdUPmbf02zKc|G?dGcSHnt2Lx52T1p93B?F8`BUBXt6%b9hJ6+ce;X+EUQfi5l$>bvH?d>%_KYuZuPA~lX{cBh$ zEEWsY%z8u*zFP!W$bGC45u8pZR8@(%PW~!#{pJxAbC$~`>h68N{JY34OM@b927Pb) zsE8uc(5t_G2&gI|(yLGdkH=%99Rwlczpbc)twk_pp?Sh_^w@EEg~Y6QYfVi3`BT-dBMy$ rpUcD63i_6)AJ8~JWC+=Vi@XPj)Y;y7p0Usod*U?441VMm`%jM#ShXZNr9$r1xZvh@h%CpU=bsXswM)43XFiz(gdiH6jiS_I>C5{heM_ z*yh*u3P8?Rwy}*QB7(S&1|Cl*B+*yqjNs|%2bm4qlPXA_dn237GF z3GxUY4EUBk2rOd_)~z*q=2y_Z711Cwh8pvHAc7?bkj-AgHYtsTG0_GS=`Iihg3J*p z0nl==Iy6}JIF@)O0s@f1u0vP?GLwk-Vz6>$4!<=6f>Dy^yVjDNHdhrLpsI#llSO8Z zGYcY+b%19iFqmW}$&q#W?4umXlth&~tVOzU40c6Q92x@ddmp33~S^MudPDAqs+mZzlvFKqUAKMv`nKghUA>?l<2| zw};)ViJO9fp{A$0r;3r+&mKA=2#yM*7*SP300#%$!Q80La0AD2rU$X_jsENq5h18h zLO@lR-J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;V<7+l literal 0 HcmV?d00001 diff --git a/textures/protector_logo.png b/textures/protector_logo.png index 20c0b8ebda65a3790ca7f3ecd2eb0f74744a80e7..c6f6f51bf4ebc7b91a725e6eaa5ca4c7bac98232 100644 GIT binary patch delta 121 zcmdnY*u^+OqKJi=fq~)e-A6${N+Q4~#P#;wTMSGLegVGo7R+6_dd0@g>(5;{^YF=o zzUNC!fNB^^g8YIR9G=}s19B8RT^vI=t|uob@JVcNkW5?|&{oYkWuZok-XW<24tfj> YZ_Y8jyTI(d1*n$6)78&qol`;+00%NHTL1t6 delta 163 zcmeBT+{`#ZqMn19fq_9omp>Rt83*`;xLN=iObphxR(=7#rR62_7R+6=WZ{x!i&w5* zv2pYI1BdpVyKv^}^((jU-g@}t!Lt`n-+g$y_RR5ZKwXR_L4Lsu4$p3+0Xce}E{-7* zmy;6~NIghPc;F!T;Q3=gAo(cOHT2+-6DN9<4jepmtXn2a%UYe;mXRSNm|=O&OjdEA ORt8U3KbLh*2~7aI*F>TK diff --git a/textures/protector_side.png b/textures/protector_side.png deleted file mode 100644 index 73ec762f8f76baae3bd8d262ecc1cb6cf7069704..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFP2=EDUWnf}(c6IV_aSHVHj)@3M zh>prkNiNFEsVXn6udbZf-L-J>g4JtR9XPb_;*|@Jo;(!rFPI0^+wJM%7{YN~wC^CN zlc9i%c+PyhE$m<=5LRn))`~?a2v@m|x!a>HQq}H(DRo zP582;;FQ%m(X*YFu3KckR)1+<+@zsxY$&oxdg?9y>>0-5J@L;U1D(a->FVdQ&MBb@ E0EDM$`~Uy| diff --git a/textures/protector_top.png b/textures/protector_top.png deleted file mode 100644 index a4bf3f8e21203fb923b4498a1e9304660836c830..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 272 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFP2=EDUb+ondba8fZa}MZVFFoYQ!3o08awK8-FW!{{%%6JvSD&v)N z@BKBt$*@DHa#mWXQWnEqei}NS*sW#x>l`P(UG-c#~Zr`f6u!p Q0iDU<>FVdQ&MBb@03XL_ApigX