[1.1.59] Events on_player_changed_position and on_player_promoted run before on_player_created

Bugs that we were not able to reproduce, and/or are waiting for more detailed info.
Post Reply
GlassBricks
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Jun 11, 2021 5:20 pm
Contact:

[1.1.59] Events on_player_changed_position and on_player_promoted run before on_player_created

Post by GlassBricks »

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.

Rseding91
Factorio Staff
Factorio Staff
Posts: 12231
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.59] Events on_player_changed_position and on_player_promoted run before on_player_created

Post by Rseding91 »

Do you have any steps to reproduce this?
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Pending”