In a mod, I initialize some data in on_player_created (and during on_init), and use it during on_player_changed_position. However, when creating a new save (freeplay scenario), on_player_changed_position was raised before on_player_created, which led to a crash (attempt to index nil, the player data).
on_player_created is usually when mods initialize player related data; so I think it makes sense that instead of the current behavior, it should fire before other player related events.
Furthermore, this issue was hard to catch, as it didn't happen when loading an existing save with the mod (it was handled in on_init instead).
I also found that on_player_promoted also fires early, although I didn't use that in my mod.
[1.1.59] Events on_player_changed_position and on_player_promoted run before on_player_created
-
- Burner Inserter
- Posts: 9
- Joined: Fri Jun 11, 2021 5:20 pm
- Contact:
Re: [1.1.59] Events on_player_changed_position and on_player_promoted run before on_player_created
Do you have any steps to reproduce this?
If you want to get ahold of me I'm almost always on Discord.