Skip to content

Commit

Permalink
Replicates upstream change which is going to be necessary
Browse files Browse the repository at this point in the history
Made this portion of the code identical to wizden so to not conflict
  • Loading branch information
rbertoche committed Dec 22, 2024
1 parent dc5b5b3 commit 622a017
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Content.Server/Antag/AntagSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,16 @@ public void MakeAntag(Entity<AntagSelectionComponent> ent, ICommonSession? sessi
{
var getEntEv = new AntagSelectEntityEvent(session, ent);
RaiseLocalEvent(ent, ref getEntEv, true);

if (!getEntEv.Handled)
{
///// Einstein Engines change /////
Log.Error($"Attempted to make {session} antagonist in gamerule {ToPrettyString(ent)} but there was no valid entity for player.");
return;
}

antagEnt = getEntEv.Entity;
}

if (antagEnt is not { } player)
{
Log.Error($"Attempted to make {session} antagonist in gamerule {ToPrettyString(ent)} but there was no valid entity for player.");
if (session != null)
ent.Comp.SelectedSessions.Remove(session);
return;
}

var getPosEv = new AntagSelectLocationEvent(session, ent);
RaiseLocalEvent(ent, ref getPosEv, true);
Expand All @@ -332,11 +329,15 @@ public void MakeAntag(Entity<AntagSelectionComponent> ent, ICommonSession? sessi
_transform.SetMapCoordinates((player, playerXform), pos);
}

// If we want to just do a ghost role spawner, set up data here and then return early.
// This could probably be an event in the future if we want to be more refined about it.
if (isSpawner)
{
if (!TryComp<GhostRoleAntagSpawnerComponent>(player, out var spawnerComp))
{
Log.Error("Antag spawner with GhostRoleAntagSpawnerComponent.");
Log.Error($"Antag spawner {player} does not have a GhostRoleAntagSpawnerComponent.");
if (session != null)
ent.Comp.SelectedSessions.Remove(session);
return;
}

Expand Down

0 comments on commit 622a017

Please sign in to comment.