Skip to content

Commit

Permalink
Set defaults for server player data
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Dec 25, 2023
1 parent 318eabb commit 074caf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion HKMP/Game/Server/ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ private void OnHelloServer(ushort id, HelloServer helloServer) {
return;
}

playerData.CurrentScene = helloServer.SceneName;
// Specifically set the position, scale and animation before current scene so that when we check if current
// scene exists, we have all other data set
playerData.Position = helloServer.Position;
playerData.Scale = helloServer.Scale;
playerData.AnimationId = helloServer.AnimationClipId;
playerData.CurrentScene = helloServer.SceneName;

var clientInfo = new List<(ushort, string)>();

Expand Down
4 changes: 2 additions & 2 deletions HKMP/Game/Server/ServerPlayerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class ServerPlayerData : IServerPlayer {
public string CurrentScene { get; set; }

/// <inheritdoc />
public Vector2 Position { get; set; }
public Vector2 Position { get; set; } = Vector2.Zero;

/// <inheritdoc />
public bool Scale { get; set; }
Expand All @@ -34,7 +34,7 @@ internal class ServerPlayerData : IServerPlayer {
public bool HasMapIcon { get; set; }

/// <inheritdoc />
public Vector2 MapPosition { get; set; }
public Vector2 MapPosition { get; set; } = Vector2.Zero;

/// <inheritdoc />
public ushort AnimationId { get; set; }
Expand Down

0 comments on commit 074caf3

Please sign in to comment.