aboutsummaryrefslogtreecommitdiffstats
path: root/code/phase/WaitPhase.cs
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-07-28 22:06:03 +0100
committerLeonardo Bishop <me@leonardobishop.com>2023-07-28 22:06:03 +0100
commit1e5c6393a6b29eb00dbb8fb137d86647cb0c356b (patch)
tree95cbba0e7ade6bd97675480c2559c8e01f74a635 /code/phase/WaitPhase.cs
parentf137095304f456b06229e4d17ee8249e974fceaf (diff)
Add TryUnstuck and death overlay
Diffstat (limited to 'code/phase/WaitPhase.cs')
-rw-r--r--code/phase/WaitPhase.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/code/phase/WaitPhase.cs b/code/phase/WaitPhase.cs
index 4f2e876..9eab094 100644
--- a/code/phase/WaitPhase.cs
+++ b/code/phase/WaitPhase.cs
@@ -23,6 +23,7 @@ public class WaitPhase : BasePhase
{
base.NextPhase = new AssignPhase();
base.IsFinished = true;
+ return;
}
else if (CountIn && !_isCountDown)
{
@@ -34,6 +35,36 @@ public class WaitPhase : BasePhase
_isCountDown = false;
base.TimeLeft = -1;
}
+
+ foreach (var client in Game.Clients)
+ {
+ if (client.Pawn == null)
+ {
+ var pawn = new Player();
+ client.Pawn = pawn;
+
+ var spawnpoints = Entity.All.OfType<SpawnPoint>();
+ var randomSpawnPoint = spawnpoints.OrderBy( x => Guid.NewGuid() ).FirstOrDefault();
+ if ( randomSpawnPoint != null )
+ {
+ var tx = randomSpawnPoint.Transform;
+ tx.Position = tx.Position + Vector3.Up * 50.0f;
+ pawn.Transform = tx;
+ }
+
+ pawn.CurrentTeam = Team.Bystander;
+ pawn.Spawn();
+ pawn.Respawn();
+ } else
+ {
+ var pawn = (Player)client.Pawn;
+ if (pawn.LifeState == LifeState.Dead)
+ {
+ pawn.CurrentTeam = Team.Bystander;
+ pawn.Respawn();
+ }
+ }
+ }
}
public override void HandleClientJoin( ClientJoinedEvent e )