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

i142857
Inserter
Inserter
Posts: 24
Joined: Mon Nov 04, 2024 9:56 am
Contact:

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

Post 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.
curiosity
Filter Inserter
Filter Inserter
Posts: 657
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

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

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3946
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
i142857
Inserter
Inserter
Posts: 24
Joined: Mon Nov 04, 2024 9:56 am
Contact:

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

Post 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.
Post Reply

Return to “Resolved Requests”