blob: 6046f9006e9079e2405e55500596f5dd273961fd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
-- node.mesecons.effector.action_on() wrapper
-- def = { node = "", suffix = "" }
mesecons_debug.register_action_on_toggle = function(def)
local nodedef = minetest.registered_nodes[def.node]
local old_action_on = nodedef and
nodedef.mesecons and
nodedef.mesecons.effector and
nodedef.mesecons.effector.action_on
if not old_action_on then
minetest.log(
"action",
"[mesecons_debug] invalid definition for " .. def.node
)
return
end
local enabled = true
nodedef.mesecons.effector.action_on = function(...)
if enabled then
old_action_on(...)
end
end
minetest.register_chatcommand("mesecons_debug_disable_" .. def.suffix, {
description = "disables the mesecon action_on() function for " .. def.node,
privs = {mesecons_debug=true},
func = function()
enabled = false
return true, "Disabled action_on() for " .. def.node
end
})
minetest.register_chatcommand("mesecons_debug_enable_" .. def.suffix, {
description = "enables the mesecon action_on() function for " .. def.node,
privs = {mesecons_debug=true},
func = function()
enabled = true
return true, "Enabled action_on() for " .. def.node
end
})
end
|