Add setting to disable events

This commit is contained in:
cora 2022-11-10 00:14:35 +01:00
parent a1e21b44c8
commit 2147790b44
2 changed files with 7 additions and 0 deletions

@ -1,5 +1,8 @@
mcl_events = {} mcl_events = {}
mcl_events.registered_events = {} mcl_events.registered_events = {}
local disabled_events = minetest.settings:get("mcl_disabled_events")
if disabled_events then disabled_events = disabled_events:split(",")
else disabled_events = {} end
local DBG = minetest.settings:get_bool("mcl_logging_event_api",false) local DBG = minetest.settings:get_bool("mcl_logging_event_api",false)
local active_events = {} local active_events = {}
@ -27,6 +30,7 @@ local function mcl_log(m,l)
end end
function mcl_events.register_event(name,def) function mcl_events.register_event(name,def)
if table.indexof(disabled_events,name) ~= -1 then return end
mcl_events.registered_events[name] = {} mcl_events.registered_events[name] = {}
--setmetatable(mcl_events.registered_events[name],tpl_eventdef) --setmetatable(mcl_events.registered_events[name],tpl_eventdef)
mcl_events.registered_events[name] = def mcl_events.registered_events[name] = def

@ -42,6 +42,9 @@ mcl_tnt_griefing (TNT destroys blocks) bool true
# Comma separated list of disabled structure names # Comma separated list of disabled structure names
mcl_disabled_structures (Disabled structures) string mcl_disabled_structures (Disabled structures) string
# Comma separated list of disabled event names
mcl_disabled_events (Disabled events) string
[Players] [Players]
# If enabled, players respawn at the bed they last lay on instead of normal # If enabled, players respawn at the bed they last lay on instead of normal
# spawn. # spawn.