diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-07-03 17:33:59 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-07-03 17:35:19 -0400 |
commit | 9d5bd90b57a1104ed98d183c8f9584b8507f88a5 (patch) | |
tree | 2c0b3d767830052677ad971d1a887eece8b01e52 | |
parent | 16146231b8f8c8562c1d1fd4a2c84bcf4134c3c5 (diff) |
add chat command to allow disabling of switching station ABM
(for situations where a user creates a laggy machine on a public server, use
this to suspend power distribution until the machine is found and disabled)
`/powerctrl off` to disable
`/powerctrl on` to reenable
(actually, anything but "on" disables it)
-rw-r--r-- | technic/machines/switching_station.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index 40b40e7..6f561e4 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -189,12 +189,29 @@ end ----------------------------------------------- -- The action code for the switching station -- ----------------------------------------------- + +technic.powerctrl_state = true + +minetest.register_chatcommand("powerctrl", { + params = "state", + description = "Enables or disables technic's switching station ABM", + privs = { basic_privs = true }, + func = function(name, state) + if state == "on" then + technic.powerctrl_state = true + else + technic.powerctrl_state = false + end + end +}) + minetest.register_abm({ nodenames = {"technic:switching_station"}, label = "Switching Station", -- allows the mtt profiler to profile this abm individually interval = 1, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) + if not technic.powerctrl_state then return end local meta = minetest.get_meta(pos) local meta1 = nil local pos1 = {} |