mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 00:49:34 +01:00
19d662dee4
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4630 Reviewed-by: teknomunk <teknomunk@protonmail.com> Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
33 lines
984 B
Markdown
33 lines
984 B
Markdown
# mcl_events
|
|
|
|
## Registering Events
|
|
|
|
`mcl_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 `event` -- starts the given event at the current player coordinates
|