From 69f5bad0bb95b81c0ebc83f1b6d7eddd4ad9bcce Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 25 Nov 2022 22:11:19 +0100 Subject: [PATCH] Document mcl_events --- mods/CORE/mcl_events/API.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mods/CORE/mcl_events/API.md diff --git a/mods/CORE/mcl_events/API.md b/mods/CORE/mcl_events/API.md new file mode 100644 index 000000000..c94328e50 --- /dev/null +++ b/mods/CORE/mcl_events/API.md @@ -0,0 +1,27 @@ +## mcl_events +### Registering Events + `mlc_events.register_event("name",def)` + +#### Event Definition + { + stage = 0, + max_stage = 1, + percent = 100, + bars = {}, + completed = false, + cond_start = function() end, + --return table of paramtables e.g. { { player = playername, pos = position, ... } }, custom parameters will be passed to the event object/table + on_step = function(event) end, + --this function is run every game step when the event is active + on_start = function(event) end, + -- this function is run when the event starts + on_stage_begin = function(event) end, + -- this function runs when a new stage of the event starts + cond_progress = function(event) end, --return false or next stage id + --this function checks if the event should progress to the next (or any other) stage + cond_complete = function(event) end, + --return true if event finished successfully +} + +### Debugging + * /event_start -- starts the given event at the current player coordinates