From 3fd74a50c8e2e29122426b11f22c4481cc1c0104 Mon Sep 17 00:00:00 2001 From: migdyn Date: Tue, 1 Jan 2019 20:16:05 +0100 Subject: [PATCH] Add more complex lamp mechanics --- init.lua | 90 ++++++++++++++++-- textures/industrial_decor_lamp_bulb.png | Bin 0 -> 362 bytes .../industrial_decor_lamp_bulb_single.png | Bin 0 -> 282 bytes textures/industrial_decor_lamp_tape.png | Bin 0 -> 546 bytes 4 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 textures/industrial_decor_lamp_bulb.png create mode 100644 textures/industrial_decor_lamp_bulb_single.png create mode 100644 textures/industrial_decor_lamp_tape.png diff --git a/init.lua b/init.lua index 42e7005..2711a12 100644 --- a/init.lua +++ b/init.lua @@ -61,7 +61,8 @@ minetest.register_node("industrial_decor:lamp",{ minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_damaged"}) end }) - + +--Damaged minetest.register_node("industrial_decor:lamp_damaged",{ description = "Damaged Industrial Lamp", drawtype = "plantlike", @@ -79,27 +80,82 @@ minetest.register_node("industrial_decor:lamp_damaged",{ type = "fixed", fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, }, + + on_rightclick = function(pos, node, player, pointed_thing) + if player:get_wielded_item():get_name() == "electronics:light_bulb_incandescent" then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_bulb"}) + elseif player:get_wielded_item():get_name() == "tapes:ducttape_black" then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_tape"}) + end + + end }) - minetest.register_node("industrial_decor:wires_hanging",{ - description = "Hanging Wires", +--Light Bulb Only +minetest.register_node("industrial_decor:lamp_bulb",{ + description = "Damaged Industrial Lamp with Light Bulb", drawtype = "plantlike", - tiles = {"industrial_decor_wires_hanging.png"}, - inventory_image = "industrial_decor_wires_hanging.png", - wield_image = "industrial_decor_wires_hanging.png", + tiles = { + { + name = "industrial_decor_lamp_bulb.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + inventory_image = "industrial_decor_lamp_bulb_single.png", + wield_image = "industrial_decor_lamp_bulb_single.png", light_propagates = true, sunlight_propagates = true, paramtype = "light", is_ground_content = false, walkable = false, - groups = {snappy = 3}, + groups = {cracky = 2}, selection_box = { type = "fixed", fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, }, + + on_rightclick = function(pos, node, player, pointed_thing) + if player:get_wielded_item():get_name() == "tapes:ducttape_black" then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_fixed"}) + end + + end }) +--Taped +minetest.register_node("industrial_decor:lamp_tape",{ + description = "Industrial Lamp with Duct Tape", + drawtype = "plantlike", + tiles = {"industrial_decor_lamp_tape.png"}, + inventory_image = "industrial_decor_lamp_tape.png", + wield_image = "industrial_decor_lamp_bulb_tape.png", + light_propagates = true, + sunlight_propagates = true, + paramtype = "light", + is_ground_content = false, + walkable = false, + + groups = {cracky = 2}, + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, + }, + + on_rightclick = function(pos, node, player, pointed_thing) + if player:get_wielded_item():get_name() == "electronics:light_bulb_incandescent" then + minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_fixed"}) + end + + end + }) + +--Fixed minetest.register_node("industrial_decor:lamp_fixed",{ description = "Fixed Industrial Lamp", drawtype = "plantlike", @@ -122,6 +178,26 @@ minetest.register_node("industrial_decor:lamp_fixed",{ minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "industrial_decor:lamp_damaged"}) end }) + --End of Lamps + + minetest.register_node("industrial_decor:wires_hanging",{ + description = "Hanging Wires", + drawtype = "plantlike", + tiles = {"industrial_decor_wires_hanging.png"}, + inventory_image = "industrial_decor_wires_hanging.png", + wield_image = "industrial_decor_wires_hanging.png", + light_propagates = true, + sunlight_propagates = true, + paramtype = "light", + is_ground_content = false, + walkable = false, + + groups = {snappy = 3}, + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, + }, + }) minetest.register_node("industrial_decor:sheet_tin",{ description = "Industrial Tin Sheet", diff --git a/textures/industrial_decor_lamp_bulb.png b/textures/industrial_decor_lamp_bulb.png new file mode 100644 index 0000000000000000000000000000000000000000..82801391871a6bc20d592ed76f0e4f98495977a9 GIT binary patch literal 362 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr!3HFmroL1HQfx`y?k+$Y2!1;6t_M<_1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP-Bcq_YsfU+Q1W-t_#5JPCIX^cyHLrxhxhOTUBsE2$ zJhLQ2!QIn0AiR-J9H{7$r;B4q#=W=GHu4@a5OCeExvtBFSJ=Rr&7(PJLZ8~?R?Z1F z4s0g`0xs|J%J1?B)0m{;=p=G}s_yCc=eE6jx#Xvy__wW>r!zA!coqdqm&Upq2Xi>y ztKP2JEYS4l=c-k!9p!psud|x=Zp+q-K;JQVy85}Sb4q9e0L&tQuK)l5 literal 0 HcmV?d00001 diff --git a/textures/industrial_decor_lamp_bulb_single.png b/textures/industrial_decor_lamp_bulb_single.png new file mode 100644 index 0000000000000000000000000000000000000000..90777f55c9bea5cb563fa07a86df3e9bfcf43bd9 GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE4yJ9g~&pOcfr z^Zwr6e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00D|gL_t(I%YBofZ`)81#((ET zL6%lWl}d+Jz9ygngOyf4Wm0&9!ulT+jbx~QOG@56X;Dd~m82eC$Y4=rxl&Lfy({qi z_U3p!V*8!H@4oNuo}_7th~S(fiXv1M5dpwjtHu~nRRC0#GS4u_RQWY@`4eTH0gwz* z!cbKY1U$HY?*bGn`FLNHE|=f+^Tk=~O3QdW#yRJ&v2%_x&-n3p$@2D- k#&OJiJ{J+$TW`CD7qqFo!noJJX#fBK07*qoM6N<$f*}Rwy#N3J literal 0 HcmV?d00001