CS2GameState made immutable
This commit is contained in:
parent
534ca30378
commit
8d865d49fd
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user