Skip to content

Commit

Permalink
digilines lcd support
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Oct 13, 2023
1 parent 19064fd commit c55e3fc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ if minetest.get_modpath("mesecons_switch") and minetest.get_modpath("mesecons_li
dofile(MP.."/mesecons/lightstones.lua")
dofile(MP.."/mesecons/switch.lua")
dofile(MP.."/mesecons/register_tool.lua")

if minetest.get_modpath("digilines") then
dofile(MP.."/mesecons/lcd.lua")
end
end

if not minetest.get_modpath("xp_redo") then
Expand Down
27 changes: 27 additions & 0 deletions mesecons/lcd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local lcd_name = "digilines:lcd"

mtui.mesecons.allowed_nodes[lcd_name] = true

local lcd_def = assert(minetest.registered_nodes[lcd_name])
local old_effector_action = assert(lcd_def.digilines.effector.action)

lcd_def.digilines.effector.action = function(pos, node, channel, msg)
old_effector_action(pos, node, channel, msg)

if type(msg) ~= "string" then
return
end

local meta = minetest.get_meta(pos)
local setchan = meta:get_string("channel")
if setchan ~= channel then return end

mtui.send_command({
type = "mesecons_event",
data = {
pos = pos,
state = msg,
nodename = node.name
}
})
end
13 changes: 12 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
name = mtui
optional_depends = mail, monitoring, mtt, monitoring, xp_redo, technic_chests, beerchat, mesecons_switch, mesecons_lightstone
optional_depends = """
mail,
monitoring,
mtt,
monitoring,
xp_redo,
technic_chests,
beerchat,
mesecons_switch,
mesecons_lightstone,
digilines
"""

0 comments on commit c55e3fc

Please sign in to comment.