mesecons/mesecons_lamp/init.lua

74 lines
2.2 KiB
Lua
Raw Normal View History

-- MESELAMPS
minetest.register_node("mesecons_lamp:lamp_on", {
2012-08-01 19:28:02 +02:00
drawtype = "nodebox",
tile_images = {"jeija_meselamp_on.png"},
paramtype = "light",
2012-08-01 19:28:02 +02:00
paramtype2 = "wallmounted",
legacy_wallmounted = true,
sunlight_propagates = true,
walkable = true,
light_source = LIGHT_MAX,
2012-08-01 19:28:02 +02:00
node_box = {
type = "wallmounted",
wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
},
selection_box = {
2012-08-01 19:28:02 +02:00
type = "wallmounted",
wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
},
groups = {dig_immediate=3,not_in_creative_inventory=1, mesecon = 1},
drop='"mesecons_lamp:lamp_off" 1',
})
minetest.register_node("mesecons_lamp:lamp_off", {
2012-08-01 19:28:02 +02:00
drawtype = "nodebox",
tile_images = {"jeija_meselamp_off.png"},
inventory_image = "jeija_meselamp.png",
wield_image = "jeija_meselamp.png",
paramtype = "light",
2012-08-01 19:28:02 +02:00
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = true,
2012-08-01 19:28:02 +02:00
node_box = {
type = "wallmounted",
wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
},
selection_box = {
2012-08-01 19:28:02 +02:00
type = "wallmounted",
wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
},
groups = {dig_immediate=3, mesecon = 1},
description="Meselamp",
})
minetest.register_craft({
output = '"mesecons_lamp:lamp_off" 1',
recipe = {
{'', '"default:glass"', ''},
{'"mesecons:mesecon_off"', '"default:steel_ingot"', '"mesecons:mesecon_off"'},
{'', '"default:glass"', ''},
}
})
mesecon:register_on_signal_on(function(pos, node)
if node.name == "mesecons_lamp:lamp_off" then
2012-08-01 19:28:02 +02:00
minetest.env:add_node(pos, {name="mesecons_lamp:lamp_on", param2 = node.param2})
nodeupdate(pos)
end
end)
mesecon:register_on_signal_off(function(pos, node)
if node.name == "mesecons_lamp:lamp_on" then
2012-08-01 19:28:02 +02:00
minetest.env:add_node(pos, {name="mesecons_lamp:lamp_off", param2 = node.param2})
nodeupdate(pos)
end
end)