2022-12-01 18:33:19 +01:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
|
2012-03-05 19:21:26 +01:00
|
|
|
-- MESELAMPS
|
2012-12-09 00:42:30 +01:00
|
|
|
-- A lamp is "is an electrical device used to create artificial light" (wikipedia)
|
|
|
|
-- guess what?
|
|
|
|
|
2017-01-15 11:53:49 +01:00
|
|
|
local mesecon_lamp_box = {
|
2012-12-26 22:54:28 +01: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},
|
|
|
|
}
|
|
|
|
|
2021-04-09 20:24:41 +02:00
|
|
|
local use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or nil
|
|
|
|
|
2012-03-05 19:21:26 +01:00
|
|
|
minetest.register_node("mesecons_lamp:lamp_on", {
|
2012-08-01 19:28:02 +02:00
|
|
|
drawtype = "nodebox",
|
2012-08-20 10:12:10 +02:00
|
|
|
tiles = {"jeija_meselamp_on.png"},
|
2021-04-09 20:24:41 +02:00
|
|
|
use_texture_alpha = use_texture_alpha,
|
2012-03-05 19:21:26 +01:00
|
|
|
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,
|
2012-03-05 19:21:26 +01:00
|
|
|
sunlight_propagates = true,
|
2012-08-05 13:37:20 +02:00
|
|
|
walkable = true,
|
2017-10-08 01:39:02 +02:00
|
|
|
light_source = minetest.LIGHT_MAX,
|
2012-12-26 22:54:28 +01:00
|
|
|
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",
|
2022-05-05 16:57:53 +02:00
|
|
|
sounds = mesecon.node_sound.glass,
|
2012-12-09 00:42:30 +01:00
|
|
|
mesecons = {effector = {
|
|
|
|
action_off = function (pos, node)
|
2013-12-01 02:20:01 +01:00
|
|
|
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,
|
2012-03-05 19:21:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("mesecons_lamp:lamp_off", {
|
2012-08-01 19:28:02 +02:00
|
|
|
drawtype = "nodebox",
|
2012-08-20 10:12:10 +02:00
|
|
|
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",
|
2012-03-05 19:21:26 +01:00
|
|
|
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-03-05 19:21:26 +01:00
|
|
|
sunlight_propagates = true,
|
2012-08-05 13:37:20 +02:00
|
|
|
walkable = true,
|
2012-12-26 22:54:28 +01:00
|
|
|
node_box = mesecon_lamp_box,
|
|
|
|
selection_box = mesecon_lamp_box,
|
2012-12-09 00:42:30 +01:00
|
|
|
groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1},
|
2022-12-01 18:33:19 +01:00
|
|
|
description = S("Mesecon Lamp"),
|
2022-05-05 16:57:53 +02:00
|
|
|
sounds = mesecon.node_sound.glass,
|
2012-12-09 00:42:30 +01:00
|
|
|
mesecons = {effector = {
|
|
|
|
action_on = function (pos, node)
|
2013-12-01 02:20:01 +01:00
|
|
|
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,
|
2012-03-05 19:21:26 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2013-04-28 12:40:08 +02:00
|
|
|
output = "mesecons_lamp:lamp_off 1",
|
2012-03-05 19:21:26 +01:00
|
|
|
recipe = {
|
2022-05-05 16:57:53 +02:00
|
|
|
{"", "mesecons_gamecompat:glass", ""},
|
|
|
|
{"group:mesecon_conductor_craftable", "mesecons_gamecompat:steel_ingot", "group:mesecon_conductor_craftable"},
|
|
|
|
{"", "mesecons_gamecompat:glass", ""},
|
2012-03-05 19:21:26 +01:00
|
|
|
}
|
|
|
|
})
|