added custom overrides, motion-sensors and more...
This commit is contained in:
parent
53466eed17
commit
ff423fc029
11 changed files with 348 additions and 26 deletions
|
|
@ -1,4 +1,4 @@
|
|||
-- Hier können beliebig viele Lampen registriert werden
|
||||
--[[ Hier können beliebig viele Lampen registriert werden
|
||||
minetest.register_on_mods_loaded(function()
|
||||
smart_light.register_lamp_control("myschool:light")
|
||||
smart_light.register_lamp_control("morelights_modern:walllamp")
|
||||
|
|
@ -21,3 +21,65 @@ minetest.register_on_mods_loaded(function()
|
|||
|
||||
-- smart_light.register_lamp_control("andere_mod:lampe")
|
||||
end)
|
||||
--]]
|
||||
|
||||
-- 1. SPEZIFISCHE MUSTER (Präzise Filter)
|
||||
local lamp_patterns = {
|
||||
-- ["mod:specific_light"] = true, -- finds specific light
|
||||
-- ["mod_pack:light.*"] = true, -- finds ex. light_normal, light_vintage, ...
|
||||
-- ["mod_pack:light_."] = true, -- finds ex. light_a, light_b, ...
|
||||
|
||||
"default:mese_post_.*",
|
||||
"ethereal:mese_post_.*",
|
||||
"morelights_modern:walllamp",
|
||||
"morelights_modern:ceilinglight",
|
||||
"morelights_modern:block",
|
||||
"morelights_modern:smallblock",
|
||||
"morelights_modern:post_.", -- post_d, post_l
|
||||
"morelights_modern:barlight_.", -- barlight_c, barlight_s
|
||||
"morelights_modern:canlight_.", -- canlight_d, canlight_l
|
||||
"morelights_modern:tablelamp_.", -- tablelamp_d, tablelamp_l
|
||||
"morelights_modern:pathlight_.", -- pathlight_d, pathlight_l
|
||||
"morelights_vintage:lantern_.", -- lantern_f, lantern_c, lantern_w
|
||||
"morelights_vintage:hangingbulb",
|
||||
"morelights_vintage:chandelier",
|
||||
"myschool:light",
|
||||
"mystreets:street_light",
|
||||
"mystreets:street_dome_light",
|
||||
"xnether:mese_post_.*",
|
||||
}
|
||||
|
||||
-- 2. BLACKLIST
|
||||
local blacklist = {
|
||||
-- ["mod:specific_light"] = true, -- finds specific light
|
||||
-- ["mod_pack:light.*"] = true, -- finds ex. light_normal, light_vintage, ...
|
||||
-- ["mod_pack:light_."] = true, -- finds ex. light_a, light_b, ...
|
||||
}
|
||||
|
||||
-- 3. AUTOMATISIERTE REGISTRIERUNG
|
||||
minetest.register_on_mods_loaded(function()
|
||||
local count = 0
|
||||
|
||||
-- Wir durchlaufen alle registrierten Nodes in der Engine
|
||||
for node_name, _ in pairs(minetest.registered_nodes) do
|
||||
|
||||
-- A: Zuerst prüfen, ob der Node auf der Blacklist steht
|
||||
if not blacklist[node_name] then
|
||||
|
||||
-- B: Dann prüfen, ob der Node zu einem der Muster passt
|
||||
for _, pattern in ipairs(lamp_patterns) do
|
||||
if node_name:find("^" .. pattern) then
|
||||
|
||||
-- C: Sicherheits-Check gegen Selbst-Registrierung
|
||||
if not node_name:find("^smart_light:") then
|
||||
smart_light.register_lamp_control(node_name)
|
||||
count = count + 1
|
||||
break -- Gefunden, nächster Node
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.log("action", "[smart_light] Automatisierung aktiv: " .. count .. " Lampen registriert.")
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue