mesecons/mesecons_lamp/init.lua

72 lines
2.2 KiB
Lua
Raw Normal View History

-- MESELAMPS
-- A lamp is "is an electrical device used to create artificial light" (wikipedia)
-- guess what?
local mesecon_lamp_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},
}
2021-04-09 20:24:41 +02:00
local use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil
minetest.register_node("mesecons_lamp:lamp_on", {
2012-08-01 19:28:02 +02:00
drawtype = "nodebox",
tiles = {"jeija_meselamp_on.png"},
2021-04-09 20:24:41 +02:00
use_texture_alpha = use_texture_alpha,
paramtype = "light",
2012-08-01 19:28:02 +02:00
paramtype2 = "wallmounted",
2017-10-31 22:50:39 +01:00
is_ground_content = false,
2012-08-01 19:28:02 +02:00
legacy_wallmounted = true,
sunlight_propagates = true,
walkable = true,
2017-10-08 01:39:02 +02:00
light_source = minetest.LIGHT_MAX,
node_box = mesecon_lamp_box,
selection_box = mesecon_lamp_box,
2017-10-08 01:39:02 +02:00
groups = {dig_immediate = 3,not_in_creative_inventory = 1, mesecon_effector_on = 1},
drop = "mesecons_lamp:lamp_off 1",
sounds = default.node_sound_glass_defaults(),
mesecons = {effector = {
action_off = function (pos, node)
minetest.swap_node(pos, {name = "mesecons_lamp:lamp_off", param2 = node.param2})
2017-10-08 01:39:02 +02:00
end,
rules = mesecon.rules.wallmounted_get,
2017-10-07 00:44:49 +02:00
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("mesecons_lamp:lamp_off", {
2012-08-01 19:28:02 +02:00
drawtype = "nodebox",
tiles = {"jeija_meselamp_off.png"},
2021-04-09 20:24:41 +02:00
use_texture_alpha = use_texture_alpha,
2012-08-01 19:28:02 +02:00
inventory_image = "jeija_meselamp.png",
wield_image = "jeija_meselamp.png",
paramtype = "light",
2012-08-01 19:28:02 +02:00
paramtype2 = "wallmounted",
2017-10-31 22:50:39 +01:00
is_ground_content = false,
sunlight_propagates = true,
walkable = true,
node_box = mesecon_lamp_box,
selection_box = mesecon_lamp_box,
groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1},
2017-10-08 01:39:02 +02:00
description = "Mesecon Lamp",
sounds = default.node_sound_glass_defaults(),
mesecons = {effector = {
action_on = function (pos, node)
minetest.swap_node(pos, {name = "mesecons_lamp:lamp_on", param2 = node.param2})
2017-10-08 01:39:02 +02:00
end,
rules = mesecon.rules.wallmounted_get,
2017-10-07 00:44:49 +02:00
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_craft({
output = "mesecons_lamp:lamp_off 1",
recipe = {
{"", "default:glass", ""},
{"group:mesecon_conductor_craftable", "default:steel_ingot", "group:mesecon_conductor_craftable"},
{"", "default:glass", ""},
}
})