Page 1 of 1

A method to detect changes in player language in Singleplayer.

Posted: Fri Jun 04, 2021 1:41 pm
by eradicator
The Problem

When a player loads a savegame in English, then saves, changes to German and reloads the savegame the only event raised is on_load. In multiplayer this is not a problem because of on_player_left_game and on_player_joined_game.

A Solution

Just to be clear: I do NOT want information about what locale a player has. I just want to know IF it changed or not.

I do not care how exactly this is implemented. During observations I noticed that sometimes on_configuration_changed is raised with ConfigurationChangedData that is just a bunch of empty tables. That would be sufficent. Raising on_player_left/joined in Singleplayer would also be sufficent (let them both happen right after on_load or something). A seperate event for this would work too but that seems like a sledgehammer method?

Why?

Because I'm dealing with LuaPlayer.request_translation so I need to know when the locale changed.