Reset PlayerInfo on PlayerControl spawn

When (re)spawning players get a new player control netobject, which is
the perfect moment to discharge them from their former duties and reset
their PlayerInfo to a default state: no role, no tasks and not dead.
This commit is contained in:
miniduikboot committed 2024-08-13 21:18:22 +02:00
1 parent 53209aa78f
commit 4452621cd3
1 file changed
+7
@@ -402,6 +402,13 @@ namespace Impostor.Server.Net.State
{
playerInfo.Controller = control;
control.PlayerInfo = playerInfo;
// Reset PlayerInfo
playerInfo.RoleType = null;
playerInfo.RoleWhenAlive = null;
playerInfo.Tasks.Clear();
playerInfo.IsDead = false;
playerInfo.IsDirty = true;
}
if (player != null)