Closed djhert closed 11 months ago
Hey! I appreciate the thoughtful report and explanation, this mistake went unnoticed and I apologize for any issues it caused. Added the correction for the next update, tyvm :)
Also, I'll take you up on that offer and add you in discord, please do reach out whenever you'd like to discuss anything or just chat.
Hello!
The
MenuOverlay.lua
functionLSMainMenuOverlay:destroy()
callsEvents.OnGameStart.Remove
during theOnGameStart
event, which causes the next registeredOnGameStart
function to not be run. Calling theEvents.OnGameStart.Remove
function during theOnGameStart
Event changes the index of the underlying array's elements, making the "next" function the current index; the next iteration then skips that function.This is easy enough to test. Using the latest Lifestyle from Steam, add the following to the very bottom of the
MenuOverlay.lua
file. This will add 3 new events toOnGameStart
: one before, and 2 after theLSManuMenuOverlay
.I also changed the
LSMenuOnDestroy()
function inMenuOverlay.lua
to the following for clarity:When running the game, the following is output:
Observe that the text "TEST: OnGameStart After" is missing, which would have been the next event in the
OnGameStart
stack. By removing following line in theLSMenuOverlay:destroy()
function:The log is as thus:
Much better, all events are triggered as expected.
You do not need to remove the function from the
OnGameStart
event stack, asOnGameStart
is only called once. If you must though, it should be done outside of theOnGameStart
event. This specific event in theMenuOverlay.lua
file is the finalOnGameStart
in base Lifestyle, so likely went unnoticed.I know this is "rich" coming from me (Fancy Handwork and all), but I promise steps are being taken on my end to fix that now. :D
Need anything else, let me know! Can ping me in Discord (dhert) if you want as well.
Thanks!