Page 1 of 1

A list of events which don't get raised in simulations

Posted: Sun Apr 20, 2025 8:36 am
by i142857
I just noticed on_player_cursor_stack_changed isn't raised in simulations. I could imagine this being intentional (to keep simulations fast/easy to implement) but my mod's behavior depends on it. I can usually fake it, so it's not a blocker, but it would be nice to have a list of events that don't work in simulations, so I know from the start instead of having to spend time to debug/investigate my own code.

Thank you!

Sorry for the barrage of simulation-related requests (and let me know if you'd like me to stop), but I'm working on simulations and keep hitting undocumented behavior.

Re: A list of events which don't get raised in simulations

Posted: Sun Apr 20, 2025 3:00 pm
by curiosity
i142857 wrote: Sun Apr 20, 2025 8:36 am Sorry for the barrage of simulation-related requests (and let me know if you'd like me to stop), but I'm working on simulations and keep hitting undocumented behavior.
That just means it needs to be documented. Don't be so hard on yourself, no one thinks the docs are perfect and all-encompassing. Keep up the good work with your reports.

Re: A list of events which don't get raised in simulations

Posted: Sun Apr 20, 2025 3:47 pm
by boskid
This looks more like a bug than a lua docs issue. on_player_cursor_stack_changed event is not raised immediately when cursor stack changes, in fact it is raised during player update but it looks like players created by LuaSimulation are kept in userConnected=false state which skips significant part of the player update logic, including one that raises the on_player_cursor_stack_changed notification. For 2.0.46 i made LuaSimulation::create_test_player to also set a created player to be connected which will make on_player_cursor_stack_changed events to be raised.

Re: A list of events which don't get raised in simulations

Posted: Mon Apr 21, 2025 4:40 pm
by i142857
Thank you, that's one less hack I have to maintain :D I'll let you know after .46 is out if I still see missing events.