diff --git a/GameState/CS2GameState.cs b/GameState/CS2GameState.cs index d15a900..9d200c8 100644 --- a/GameState/CS2GameState.cs +++ b/GameState/CS2GameState.cs @@ -14,4 +14,31 @@ public struct CS2GameState $"\t{Map}\n" + $"\t{Player}\n"; } + + internal CS2GameState? UpdateGameStateForLocal(CS2GameState? previousLocalState) + { + if (previousLocalState is null) + return this.Player?.SteamId == ProviderSteamId ? this : null; + if (this.Player?.SteamId != ProviderSteamId) + return this.WithPlayer(previousLocalState.Value.Player); + return this; + } + + private CS2GameState WithPlayer(Player? player) + { + this.Player = player; + return this; + } + + private CS2GameState WithMap(Map? map) + { + this.Map = map; + return this; + } + + private CS2GameState WithTimestamp(int timestamp) + { + this.Timestamp = timestamp; + return this; + } } \ No newline at end of file