aboutsummaryrefslogtreecommitdiff
path: root/overrides.lua
diff options
context:
space:
mode:
authorThomas Rudin <thomas@rudin.io>2019-10-09 20:59:42 +0200
committerThomas Rudin <thomas@rudin.io>2019-10-09 20:59:42 +0200
commitf1ffd844c0ae52823bef0dbbbc51cce35217c898 (patch)
tree95910324797f2968e5576f5f3a278b2b0a6aefaa /overrides.lua
parent3c99500ff8d0e7344d1dcb443428c34a8ef9b2c2 (diff)
downloadmesecons_debug-f1ffd844c0ae52823bef0dbbbc51cce35217c898.tar.gz
mesecons_debug-f1ffd844c0ae52823bef0dbbbc51cce35217c898.zip
radical cleanup
Diffstat (limited to 'overrides.lua')
-rw-r--r--overrides.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/overrides.lua b/overrides.lua
new file mode 100644
index 0000000..4bf241e
--- /dev/null
+++ b/overrides.lua
@@ -0,0 +1,42 @@
+
+-- enable/disable mesecons entirely
+
+local enabled = true
+
+
+-- execute()
+local old_execute = mesecon.queue.execute
+mesecon.queue.execute = function(...)
+ if enabled then
+ old_execute(...)
+ end
+end
+
+-- add_action()
+local old_add_action = mesecon.queue.add_action
+mesecon.queue.add_action = function(...)
+ if enabled then
+ old_add_action(...)
+ end
+end
+
+
+minetest.register_chatcommand("mesecons_enable", {
+ description = "enables the mesecons globlastep",
+ privs = {mesecons_debug=true},
+ func = function()
+ enabled = true
+ return true, "mesecons enabled"
+ end
+})
+
+minetest.register_chatcommand("mesecons_disable", {
+ description = "disables the mesecons globlastep",
+ privs = {mesecons_debug=true},
+ func = function()
+ enabled = false
+ -- flush actions, while we are on it
+ mesecon.queue.actions = {}
+ return true, "mesecons disabled"
+ end
+})