Add more complex lamp mechanics

master
migdyn 2019-01-01 20:16:05 +01:00
parent 97fdc14f22
commit 3fd74a50c8
4 changed files with 83 additions and 7 deletions

View File

@ -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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B