diff --git a/src/Application/Players/ClassSelectionSystem.cs b/src/Application/Players/ClassSelectionSystem.cs index 04a0fdf1..697cf89c 100644 --- a/src/Application/Players/ClassSelectionSystem.cs +++ b/src/Application/Players/ClassSelectionSystem.cs @@ -11,6 +11,13 @@ public void OnPlayerConnect(Player player) [Event] public void OnPlayerRequestClass(Player player, int classId) { + if(player.HasForcedClassSelectionAfterDeath()) + { + player.SetSpawnInfo(player.Team, player.Skin, player.Position, player.Angle); + player.Spawn(); + return; + } + player.Color = Color.White; player.Position = new Vector3(-1389.137451, 3314.043701, 20.493314); player.CameraPosition = new Vector3(-1399.776000, 3310.254150, 21.525623); diff --git a/src/Application/Players/Extensions/ClassSelectionExtensions.cs b/src/Application/Players/Extensions/ClassSelectionExtensions.cs new file mode 100644 index 00000000..b6c50193 --- /dev/null +++ b/src/Application/Players/Extensions/ClassSelectionExtensions.cs @@ -0,0 +1,19 @@ +namespace CTF.Application.Players.Extensions; + +public static class ClassSelectionExtensions +{ + public static bool IsInClassSelection(this Player player) + => player.GetComponent().IsInClassSelection; + + public static bool IsNotInClassSelection(this Player player) + => !player.IsInClassSelection(); + + public static bool HasForcedClassSelectionAfterDeath(this Player player) + => !player.IsInClassSelection(); + + public static void SetInClassSelection(this Player player) + => player.GetComponent().IsInClassSelection = true; + + public static void RemoveFromClassSelection(this Player player) + => player.GetComponent().IsInClassSelection = false; +} diff --git a/src/Application/Players/PlayerSpawnSystem.cs b/src/Application/Players/PlayerSpawnSystem.cs index 61461351..22304a71 100644 --- a/src/Application/Players/PlayerSpawnSystem.cs +++ b/src/Application/Players/PlayerSpawnSystem.cs @@ -21,7 +21,7 @@ public bool OnPlayerRequestSpawn(Player player) player.GameText(gameText, 999999999, 3); return false; } - player.GetComponent().IsInClassSelection = false; + player.RemoveFromClassSelection(); player.GameText("_", 1000, 4); accountComponent.PlayerInfo.SetTeam(selectedTeam.Id); selectedTeam.Members.Add(player);