forked from VoxeLibre/VoxeLibre
Make debug output an opt-in setting
This commit is contained in:
parent
99fce095ef
commit
7ab2c5fecd
|
@ -1,5 +1,6 @@
|
|||
mcl_events = {}
|
||||
mcl_events.registered_events = {}
|
||||
local DBG = minetest.settings:get_bool("mcl_logging_event_api",false)
|
||||
local active_events = {}
|
||||
|
||||
local tpl_eventdef = {
|
||||
|
@ -18,6 +19,13 @@ local tpl_eventdef = {
|
|||
cond_complete = function(event) end, --return success
|
||||
}
|
||||
|
||||
local function mcl_log(m,l)
|
||||
if DBG then
|
||||
if not l then l = "action" end
|
||||
minetest.log(l,"[mcl_events] "..m)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_events.register_event(name,def)
|
||||
mcl_events.registered_events[name] = {}
|
||||
--setmetatable(mcl_events.registered_events[name],tpl_eventdef)
|
||||
|
@ -41,7 +49,7 @@ local function update_bars(self)
|
|||
end
|
||||
|
||||
local function start_event(p,e)
|
||||
minetest.log("event started: "..e.name.." at "..minetest.pos_to_string(p))
|
||||
mcl_log("event started: "..e.name.." at "..minetest.pos_to_string(vector.round(p)))
|
||||
local idx = #active_events + 1
|
||||
active_events[idx] = table.copy(e)
|
||||
setmetatable(active_events[idx],e)
|
||||
|
@ -55,7 +63,7 @@ local function start_event(p,e)
|
|||
end
|
||||
|
||||
local function finish_event(self,idx)
|
||||
minetest.log("event finished: "..self.name.." at "..minetest.pos_to_string(self.pos))
|
||||
mcl_log("Finished: "..self.name.." at "..minetest.pos_to_string(vector.round(self.pos)))
|
||||
if self.on_complete then self:on_complete() end
|
||||
for _,b in pairs(self.bars) do
|
||||
mcl_bossbars.remove_bar(b)
|
||||
|
@ -159,7 +167,7 @@ mcl_events.register_event("infestation",{
|
|||
return self.stage >= self.max_stage and #m < 1
|
||||
end,
|
||||
on_complete = function(self)
|
||||
minetest.log("INFESTATION complete")
|
||||
mcl_log("INFESTATION complete")
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -233,4 +233,7 @@ mcl_logging_mapgen (Chunk generation logging) bool false
|
|||
mcl_logging_structures (Structure generation logging) bool true
|
||||
|
||||
#Complete debug logging for mcl_signs events. Use this if you have issues with signs.
|
||||
mcl_logging_mcl_signs (Complete debug logging for mcl_signs) bool true
|
||||
mcl_logging_mcl_signs (Complete debug logging for mcl_signs) bool false
|
||||
|
||||
#Debug logging for mcl_events.
|
||||
mcl_logging_event_api (Debug logging for mcl_events) bool false
|
||||
|
|
Loading…
Reference in New Issue