oh no all hell broke loose ghost roles are broken (#43735)

* :3

* mild improvement

* let ghosts become antags

* MORE!!!

---------

Co-authored-by: nomdéraisonnablementlong <you@example.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
KeTuFaisPiKiNut
2026-04-26 22:21:38 -04:00
committed by GitHub
parent f1c1024c1f
commit 552943ee3c
5 changed files with 22 additions and 8 deletions
+5
View File
@@ -13,6 +13,11 @@ public static partial class PoolManager
public static readonly ContentPoolManager Instance = new();
public const string TestMap = "Empty";
/// <summary>
/// Designated load bearing station. Sometimes you need a station for a test.
/// </summary>
public const string TestStation = "Saltern";
/// <summary>
/// Runs a server, or a client until a condition is true
/// </summary>
@@ -13,7 +13,8 @@ public sealed class StartEndGameRulesTest : GameTest
public override PoolSettings PoolSettings => new PoolSettings
{
Dirty = true,
DummyTicker = false
DummyTicker = false,
Map = PoolManager.TestStation
};
/// <summary>
@@ -39,7 +39,7 @@ public sealed class EvacShuttleTest : GameTest
pair.Server.CfgMan.SetCVar(CCVars.EmergencyShuttleEnabled, true);
pair.Server.CfgMan.SetCVar(CCVars.GameDummyTicker, false);
var gameMap = pair.Server.CfgMan.GetCVar(CCVars.GameMap);
pair.Server.CfgMan.SetCVar(CCVars.GameMap, "Saltern");
pair.Server.CfgMan.SetCVar(CCVars.GameMap, PoolManager.TestStation);
await server.WaitPost(() => ticker.RestartRound());
await pair.RunTicksSync(25);
@@ -113,7 +113,7 @@ public sealed partial class AntagSelectionSystem
}
}
return player.AttachedEntity == null || IsEntityValid(player, def);
return player.AttachedEntity == null || HasComp<GhostComponent>(player.AttachedEntity) || IsEntityValid(player, def);
}
/// <inhereitdoc cref="IsMindValid(EntityUid?,AntagSpecifierPrototype)"/>
+13 -5
View File
@@ -126,9 +126,19 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
// Antags haven't been selected so we need to select them! Only if we select when the game rule starts though!
if (component.PreSelectionsComplete)
{
AssignPreSelectedSessions((uid, component));
else if (component.SelectionTime == RuleStarted) // Only pre-select antags if we pre-select on rule start
AssignAntags((uid, component));
return;
}
// If pre-selections haven't completed, then we need to select and assign antags.
var players = GetActivePlayers().ToArray();
if (component.SelectionTime == RuleStarted) // Only pre-select antags if we pre-select on rule start
AssignAntags((uid, component), players);
// Any antags not spawned we make ghost roles for!
SpawnGhostRoles((uid, component), players.Length);
}
private void OnTakeGhostRole(Entity<GhostRoleAntagSpawnerComponent> ent, ref TakeGhostRoleEvent args)
@@ -767,9 +777,7 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem<AntagSelection
_loadout.Equip(antag, gear, prototype.RoleLoadout);
// Ensure that we have a mind for our entity!
if (player.GetMind() is not { } mind
|| !TryComp<MindComponent>(mind, out var mindComp)
|| mindComp.OwnedEntity != antag)
if (player.GetMind() is not { } mind)
mind = _mind.CreateMind(player.UserId, Name(antag));
_mind.TransferTo(mind, antag, ghostCheckOverride: true);