Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Oct 12, 2023
1 parent e453306 commit a1b7dbe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
9 changes: 1 addition & 8 deletions handlers/mesecons.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

local button_off_def = assert(minetest.registered_nodes["mesecons_button:button_off"])
local switch_off_def = assert(minetest.registered_nodes["mesecons_switch:mesecon_switch_off"])
local switch_on_def = assert(minetest.registered_nodes["mesecons_switch:mesecon_switch_on"])

-- ui -> game
-- enable/disable switch or press button for an amount of time
-- enable/disable switch
mtui.register_on_command("mesecons_set", function(data)
minetest.load_area(data.pos)
local node = minetest.get_node_or_nil(data.pos)
Expand All @@ -18,12 +17,6 @@ mtui.register_on_command("mesecons_set", function(data)
-- switch in off-state, turn on
switch_off_def.on_rightclick(data.pos, node)
return { success = true }
elseif node.name == "mesecons_button:button_off" then
-- button in off-state, turn on for 1 second
button_off_def.on_rightclick(data.pos, node)
-- call turnoff async, in case the node-timer does not fire (unloaded area)
minetest.after(1, mesecon.button_turnoff, data.pos)
return { success = true }
end
elseif data.state == "off" then
if node.name == "mesecons_switch:mesecon_switch_on" then
Expand Down
4 changes: 1 addition & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ dofile(MP.."/handlers/execute_command.lua")
dofile(MP.."/handlers/lua.lua")
dofile(MP.."/handlers/controls.lua")

if minetest.get_modpath("mesecons_switch")
and minetest.get_modpath("mesecons_button")
and minetest.get_modpath("mesecons_lightstone") then
if minetest.get_modpath("mesecons_switch") and minetest.get_modpath("mesecons_lightstone") then
dofile(MP.."/handlers/mesecons.lua")
end

Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = mtui
optional_depends = mail, monitoring, mtt, monitoring, xp_redo, technic_chests, beerchat, mesecons_switch, mesecons_button, mesecons_lightstone
optional_depends = mail, monitoring, mtt, monitoring, xp_redo, technic_chests, beerchat, mesecons_switch, mesecons_lightstone

0 comments on commit a1b7dbe

Please sign in to comment.