diff --git a/exp_player_statistics/controller.ts b/exp_player_statistics/controller.ts index 21bd1f95..815eb124 100644 --- a/exp_player_statistics/controller.ts +++ b/exp_player_statistics/controller.ts @@ -49,7 +49,7 @@ export default async function (context: ControllerPluginContext) { const record = players.get(request.name); return new messages.PlayerStatistics(request.name, { ...record?.stats, - ...messages.userStatistics(controller.users.getByName(request.name)), + ...messages.userStatistics(controller.users.getByName(request.name), record?.stats), }, record?.updatedAtMs); }); diff --git a/exp_player_statistics/messages.ts b/exp_player_statistics/messages.ts index ad6f8da3..d984d55f 100644 --- a/exp_player_statistics/messages.ts +++ b/exp_player_statistics/messages.ts @@ -42,11 +42,11 @@ export class PlayerStatistics { } } -/** Statistics clusterio already keeps for every user, shown with the others but never added to */ -export function userStatistics(user?: Pick): Record { +/** Statistics clusterio already keeps for every user, shown with the others but never added to, existing stats may contain legacy values */ +export function userStatistics(user?: Pick, stats: Record = {}): Record { return { - Playtime: Math.floor((user?.playerStats.onlineTimeMs ?? 0) / 60e3), - JoinCount: user?.playerStats.joinCount ?? 0, + Playtime: (stats.Playtime ?? 0) + Math.floor((user?.playerStats.onlineTimeMs ?? 0) / 60e3), + JoinCount: (stats.JoinCount ?? 0) + (user?.playerStats.joinCount ?? 0), }; } diff --git a/exp_scenario/module/gui/readme.lua b/exp_scenario/module/gui/readme.lua index c0f55621..61364671 100644 --- a/exp_scenario/module/gui/readme.lua +++ b/exp_scenario/module/gui/readme.lua @@ -180,7 +180,7 @@ function Elements.join_server.refresh(button, server) elseif status == "Modded" then button.enabled = true - button.sprite = "utility/downloading_white" + button.sprite = "utility/downloading" button.hovered_sprite = "utility/downloading" else