Skip to content

Commit

Permalink
add mcl2 support of the mesecons lightstones fork
Browse files Browse the repository at this point in the history
fixes #9
  • Loading branch information
BuckarooBanzay committed Oct 23, 2023
1 parent 17a8376 commit 3a4acec
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions mesecons/lightstones.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@

-- catch on/off events from lightstones
local lightstone_colors = {
"red",
"green",
"blue",
"gray",
"darkgray",
"yellow",
"orange",
"white",
"pink",
"magenta",
"cyan",
"violet"
}

for _, color in ipairs(lightstone_colors) do
local on_nodename = "mesecons_lightstone:lightstone_" .. color .. "_on"
local off_nodename = "mesecons_lightstone:lightstone_" .. color .. "_off"
local function register(on_nodename, off_nodename)
local def_on = minetest.registered_nodes[on_nodename]
if not def_on then
return
end

mtui.mesecons.allowed_nodes[on_nodename] = true
mtui.mesecons.allowed_nodes[off_nodename] = true

local def_on = assert(minetest.registered_nodes[on_nodename])
local old_action_off = assert(def_on.mesecons.effector.action_off)
def_on.mesecons.effector.action_off = function(pos, node)
mtui.send_command({
Expand Down Expand Up @@ -50,3 +35,28 @@ for _, color in ipairs(lightstone_colors) do
return old_action_on(pos, node)
end
end

-- catch on/off events from lightstones
local lightstone_colors = {
"red",
"green",
"blue",
"gray",
"darkgray",
"yellow",
"orange",
"white",
"pink",
"magenta",
"cyan",
"violet"
}

for _, color in ipairs(lightstone_colors) do
local on_nodename = "mesecons_lightstone:lightstone_" .. color .. "_on"
local off_nodename = "mesecons_lightstone:lightstone_" .. color .. "_off"
register(on_nodename, off_nodename)
end

-- mcl2 fork of mesecons
register("mesecons_lightstone:lightstone_on", "mesecons_lightstone:lightstone_off")

0 comments on commit 3a4acec

Please sign in to comment.