mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-18 14:53:13 +09:00
Show the language of players on their user page
exp_legacy recorded each player's locale in PlayerData statistics which nothing read. The lua side now sends one ipc event with the player's locale when they join and when they change language, the instance forwards it, and the controller stores it on the player record. The Scenario section of the user page shows the language by name with a flag made from regional indicator symbols. Locales with a region use it directly, the rest map to a country through a small table covering Factorio's locale list. Arabic, Catalan, Basque, and Esperanto have no single country and get no flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6821d62c10
commit
ebe7504c00
17 files changed
+155
-34
No files matched your search
@@ -278,6 +278,18 @@ t.test("player settings", t2 => {
|
||||
t3.equal(record.joinMessage, "Bye", "kept across restarts");
|
||||
});
|
||||
|
||||
t2.test("PlayerLocaleEvent stores the locale next to the join message", async t3 => {
|
||||
const { send } = await startPlugin(t3, { withPlugins: false });
|
||||
await send(new messages.JoinMessageSetRequest("Alice", "Hi"));
|
||||
await send(new messages.PlayerLocaleEvent("Alice", "pt-BR"));
|
||||
const record = await send(new messages.PlayerGetRequest("Alice"));
|
||||
t3.strictSame([record.joinMessage, record.locale], ["Hi", "pt-BR"]);
|
||||
|
||||
await send(new messages.JoinMessageSetRequest("Alice", null));
|
||||
const cleared = await send(new messages.PlayerGetRequest("Alice"));
|
||||
t3.equal(cleared.locale, "pt-BR", "clearing the message keeps the locale");
|
||||
});
|
||||
|
||||
t2.test("permissions", async t3 => {
|
||||
const user = (name, granted = []) => ({
|
||||
name,
|
||||
|
||||
Reference in new issue
Block a user