mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
fill-out mesecons support for first few lights,
also removed debug prints Lights are forced-on when placed, and remain so until they receive a mesecons "off" signal. Lights can be toggled on/off independent of the mesecon signal state by right click, which will persist until the next signal transition, which will change the light to follow.
This commit is contained in:
parent
542f688c09
commit
07141bff47
@ -4,33 +4,27 @@ local S = homedecor.gettext
|
|||||||
|
|
||||||
if minetest.get_modpath("mesecons") then
|
if minetest.get_modpath("mesecons") then
|
||||||
homedecor.mesecon_wall_light = {
|
homedecor.mesecon_wall_light = {
|
||||||
off = {
|
effector = {
|
||||||
effector = {
|
action_off = function(pos, node)
|
||||||
action_off = function(pos, node)
|
local sep = string.find(node.name, "_o", -5)
|
||||||
print("off event")
|
local onoff = string.sub(node.name, sep + 1)
|
||||||
local sep = string.find(node.name, "_o", -5)
|
if minetest.get_meta(pos):get_int("toggled") > 0 then
|
||||||
local onoff = string.sub(node.name, sep + 1)
|
|
||||||
minetest.swap_node(pos, {
|
minetest.swap_node(pos, {
|
||||||
name = string.sub(node.name, 1, sep - 1).."_off",
|
name = string.sub(node.name, 1, sep - 1).."_off",
|
||||||
param2 = node.param2
|
param2 = node.param2
|
||||||
})
|
})
|
||||||
end,
|
end
|
||||||
rules = mesecon.rules.wallmounted_get
|
end,
|
||||||
}
|
action_on = function(pos, node)
|
||||||
},
|
minetest.get_meta(pos):set_int("toggled", 1)
|
||||||
on = {
|
local sep = string.find(node.name, "_o", -5)
|
||||||
effector = {
|
local onoff = string.sub(node.name, sep + 1)
|
||||||
action_on = function(pos, node)
|
minetest.swap_node(pos, {
|
||||||
print("on event")
|
name = string.sub(node.name, 1, sep - 1).."_on",
|
||||||
local sep = string.find(node.name, "_o", -5)
|
param2 = node.param2
|
||||||
local onoff = string.sub(node.name, sep + 1)
|
})
|
||||||
minetest.swap_node(pos, {
|
end,
|
||||||
name = string.sub(node.name, 1, sep - 1).."_on",
|
rules = mesecon.rules.wallmounted_get
|
||||||
param2 = node.param2
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
rules = mesecon.rules.wallmounted_get
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -58,6 +52,9 @@ end
|
|||||||
for _, onoff in ipairs({"on", "off"}) do
|
for _, onoff in ipairs({"on", "off"}) do
|
||||||
|
|
||||||
local onflag = (onoff == "on")
|
local onflag = (onoff == "on")
|
||||||
|
local offon = "on" -- always the inverse of 'onoff'
|
||||||
|
if onoff == "on" then offon = "off" end
|
||||||
|
|
||||||
local tiles
|
local tiles
|
||||||
local overlay
|
local overlay
|
||||||
local nici
|
local nici
|
||||||
@ -135,11 +132,9 @@ for _, onoff in ipairs({"on", "off"}) do
|
|||||||
{items = {"homedecor:glowlight_half_on"}, inherit_color = true },
|
{items = {"homedecor:glowlight_half_on"}, inherit_color = true },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mesecons = homedecor.mesecon_wall_light[onoff]
|
mesecons = homedecor.mesecon_wall_light
|
||||||
})
|
})
|
||||||
|
|
||||||
print("##################")
|
|
||||||
print(dump(homedecor.mesecon_wall_light[onoff]))
|
|
||||||
sides_edges = "homedecor_glowlight_thin_sides_edges.png"
|
sides_edges = "homedecor_glowlight_thin_sides_edges.png"
|
||||||
sides_glare = "homedecor_glowlight_thin_sides_glare.png"
|
sides_glare = "homedecor_glowlight_thin_sides_glare.png"
|
||||||
|
|
||||||
@ -200,7 +195,7 @@ for _, onoff in ipairs({"on", "off"}) do
|
|||||||
{items = {"homedecor:glowlight_quarter_on"}, inherit_color = true },
|
{items = {"homedecor:glowlight_quarter_on"}, inherit_color = true },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mesecons = homedecor.mesecon_wall_light[onoff]
|
mesecons = homedecor.mesecon_wall_light
|
||||||
})
|
})
|
||||||
|
|
||||||
tb_edges = "homedecor_glowlight_cube_tb_edges.png"
|
tb_edges = "homedecor_glowlight_cube_tb_edges.png"
|
||||||
@ -264,7 +259,7 @@ for _, onoff in ipairs({"on", "off"}) do
|
|||||||
{items = {"homedecor:glowlight_small_cube_on"}, inherit_color = true },
|
{items = {"homedecor:glowlight_small_cube_on"}, inherit_color = true },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mesecons = homedecor.mesecon_wall_light[onoff]
|
mesecons = homedecor.mesecon_wall_light
|
||||||
})
|
})
|
||||||
|
|
||||||
local lighttex
|
local lighttex
|
||||||
|
Loading…
Reference in New Issue
Block a user