Skip to content

Commit ac64e92

Browse files
authored
feat: Adding base game All players spawned event for exiled (#558)
* Add RoleAssigner.OnPlayersSpawned * Add Handler
1 parent daaa1eb commit ac64e92

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

EXILED/Exiled.Events/Events.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public override void OnEnabled()
7373
Handlers.Map.ChangedIntoGrenade += Handlers.Internal.ExplodingGrenade.OnChangedIntoGrenade;
7474

7575
CharacterClassManager.OnRoundStarted += Handlers.Server.OnRoundStarted;
76+
RoleAssigner.OnPlayersSpawned += Handlers.Server.OnAllPlayersSpawned;
7677
WaveManager.OnWaveSpawned += Handlers.Server.OnRespawnedTeam;
7778
InventorySystem.InventoryExtensions.OnItemAdded += Handlers.Player.OnItemAdded;
7879
InventorySystem.InventoryExtensions.OnItemRemoved += Handlers.Player.OnItemRemoved;
@@ -113,6 +114,7 @@ public override void OnDisabled()
113114

114115
InventorySystem.InventoryExtensions.OnItemAdded -= Handlers.Player.OnItemAdded;
115116
InventorySystem.InventoryExtensions.OnItemRemoved -= Handlers.Player.OnItemRemoved;
117+
RoleAssigner.OnPlayersSpawned -= Handlers.Server.OnAllPlayersSpawned;
116118
WaveManager.OnWaveSpawned -= Handlers.Server.OnRespawnedTeam;
117119
RagdollManager.OnRagdollSpawned -= Handlers.Internal.RagdollList.OnSpawnedRagdoll;
118120
RagdollManager.OnRagdollRemoved -= Handlers.Internal.RagdollList.OnRemovedRagdoll;
@@ -161,4 +163,4 @@ public void Unpatch()
161163
Log.Debug("All events have been unpatched complete. Goodbye!");
162164
}
163165
}
164-
}
166+
}

EXILED/Exiled.Events/Handlers/Server.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public static class Server
3232
/// </summary>
3333
public static Event RoundStarted { get; set; } = new();
3434

35+
/// <summary>
36+
/// Invoked after all players have spawned at the start of a new round.
37+
/// </summary>
38+
public static Event AllPlayersSpawned { get; set; } = new();
39+
3540
/// <summary>
3641
/// Invoked before ending a round.
3742
/// </summary>
@@ -137,6 +142,11 @@ public static class Server
137142
/// </summary>
138143
public static void OnRoundStarted() => RoundStarted.InvokeSafely();
139144

145+
/// <summary>
146+
/// Called after all players have spawned at the start of a new round.
147+
/// </summary>
148+
public static void OnAllPlayersSpawned() => AllPlayersSpawned.InvokeSafely();
149+
140150
/// <summary>
141151
/// Called before ending a round.
142152
/// </summary>
@@ -245,4 +255,4 @@ public static class Server
245255
/// <param name="ev">The <see cref="CompletingObjectiveEventArgs"/> instance.</param>
246256
public static void OnCompletingObjective(CompletingObjectiveEventArgs ev) => CompletingObjective.InvokeSafely(ev);
247257
}
248-
}
258+
}

0 commit comments

Comments
 (0)