[ENHANCEMENT + BUGFIX] small script event/module overhaul #4172
+166
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Does this PR close any issues? If so, link them below.
fixes #4167
fixes #3928
Briefly describe the issue(s) fixed.
after messing with modules a lot, ive come up with a few changes id like implemented!
this pr makes some additions and changes to certain script events, primarily relating to modules and playstate
onDestroy
now calls in reverse module priority order (its reverse so that modules dependent on others have the callback first)onCreate
is now called whenever the module is created, including after a mod reloadIGlobalScriptedClass
template (extendsIPlayStateScriptedClass
andIStateChangingScriptedClass
) for the following:onGameInit(event:ScriptEvent)
callback for what is the currentonCreate
behavior, that is only called only when the game first startsonGameClose(event:GameCloseScriptEvent)
callback for whenever the game closesGameCloseScriptEvent extends ScriptEvent
that holds the exit codePlayState
no longer callsonDestroy
in modules (only module destruction will)IPlayStateScriptedClass
now has:onPlayStateCreate(event:ScriptEvent)
- helper event, called near the end ofPlayState.instance.create()
right before the countdown startsonPlayStateClose(event:ScriptEvent)
- helper event, called beforePlayState
does cleanuponCreate
will be called regardless ofactive
(onDestroy
currently does this)Warning
this has breaking changes!!
existing modules should:
onCreate
toonGameInit
active
inonCreate
if any code depends on it not running when inactiveonDestroy
code that deals withPlayState
destruction toonPlayStateClose
Include any relevant screenshots or videos.
8mb.video-NRT-8aGTNnTB.mp4