Skip to content

Add "MapFinish" Lua hook and upgrade Intermission Lua hooks

Skydusk requested to merge Acelite/SRB2:levelendhooks into next

Documentation:

Updated -

IntermissionThinker

Hook format: addHook("IntermissionThinker", functionname)

Function format: function(*boolean* stagefailed, *int* intertic, *int* tallydonetic, *int* endtic, *int* intertype)

Function return value: Boolean (true = ends intermission, false = pauses intermission, nil/none = use default behavior)

Executes every tic during any end-map intermission screen ('Character got through the act' screen). intertic, tallydonetic, endtic are all intermission tickers used by vanilla, when inactive all tickers default to -1. stagefailed if the stage is failed, returns true. intertic is the current intermission tic. tallydonetic is the tic timestamp when the visual intermission calculation finishes or player skipped the calculation. endtic is predetermined tic timestamp after tallydonetic is registered and when intertic reaches endtic, intermission ends. Finally, intertype is the type of intermission that is playing. If the function returns true it directly ends the intermission sequence. Returning false pauses intertic from progressing. Otherwise (return, return nil, or no return value) results in default behaviour.

Hook name Function format Description
"intermission" function(drawer v, boolean stagefailed, int ticker, int tallydonetic, int endtime, int intertype) The function is run when intermissions between maps are displayed.

Notes:
- stagefailed if the stage is failed, returns true.
- ticker is the amount of time, in tics, that the intermission has been displayed
- tallydonetic is the value of ticker at which vanilla visual tally finished.
- endtime is the value of ticker at which the intermission will end and stop displaying.
- intertype is the type of intermission that is playing.

New -

MapFinish

Hook format: addHook("MapFinish", functionname)

Function format: function(*int* skipstats, *int* currentmap, *int* nextmap)

Function return value: Boolean (true = interrupts stops map end sequence from activating, false = denying score awards from intermission, nil/none = use default behaviour)

Executes before the map ends. Useful for setup still within the map before intermission starts and game state changes. currentmap is the identification of the current map. nextmap is the identification of the next map. skipstats is a variable whether or not intermission gets skipped by the custom exit. If the function returns true then the sequence that would normally follow map exit would be ceased. Returning false merely denies any awards gained by the following map end intermission. Otherwise (return, return nil, or no return value) results in default behaviour.

Testing script (jump - skip, spin - pause) for intermission, GFZ1 won't reward you no matter what you do and you won't be able to finish GFZ2: intermission_test2.lua

Remerge - no ghost commits.

Edited by Skydusk

Merge request reports

Loading