Skip to content

Commit

Permalink
hotfix job spawners
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Feb 4, 2024
1 parent 473630b commit 5572002
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Content.Server/Backmen/Fugitive/FugitiveSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public override void Initialize()
SubscribeLocalEvent<FugitiveComponent, GhostRoleSpawnerUsedEvent>(OnSpawned);
SubscribeLocalEvent<FugitiveComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
SubscribeLocalEvent<PlayerSpawningEvent>(OnPlayerSpawn,
before: new[] { typeof(ContainerSpawnPointSystem),typeof(ArrivalsSystem), typeof(SpawnPointSystem) });
}

[ValidatePrototypeId<JobPrototype>]
Expand All @@ -87,7 +85,7 @@ public override void Initialize()
[ValidatePrototypeId<JobPrototype>]
private const string JobSAI = "SAI";

private void OnPlayerSpawn(PlayerSpawningEvent args)
public void HandlePlayerSpawning(PlayerSpawningEvent args)
{
if (args.SpawnResult != null)
return;
Expand Down Expand Up @@ -120,6 +118,8 @@ private void OnPlayerSpawn(PlayerSpawningEvent args)
}
}

// auto points

#region Prisoner

if (possiblePositions.Count == 0 && args.Job?.Prototype == JobPrisoner)
Expand Down Expand Up @@ -192,9 +192,9 @@ private void OnPlayerSpawn(PlayerSpawningEvent args)
args.Station);
}

public bool MakeFugitive([NotNullWhen(true)] out EntityUid? Fugitive, bool forceHuman = false)
public bool MakeFugitive([NotNullWhen(true)] out EntityUid? fugitive, bool forceHuman = false)
{
Fugitive = null;
fugitive = null;

EntityUid? station = null;

Expand All @@ -221,10 +221,10 @@ public bool MakeFugitive([NotNullWhen(true)] out EntityUid? Fugitive, bool force
}

var coords = _random.Pick(latejoin);
Fugitive = Spawn(forceHuman ? SpawnMobPrototype : SpawnPointPrototype, coords);
fugitive = Spawn(forceHuman ? SpawnMobPrototype : SpawnPointPrototype, coords);
if (forceHuman)
{
EnsureComp<FugitiveComponent>(Fugitive.Value).ForcedHuman = true;
EnsureComp<FugitiveComponent>(fugitive.Value).ForcedHuman = true;
}

return true;
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem
[Dependency] private readonly ArrivalsSystem _arrivalsSystem = default!;
[Dependency] private readonly ContainerSpawnPointSystem _containerSpawnPointSystem = default!;

[Dependency] private readonly Backmen.Fugitive.FugitiveSystem _fugitiveSystem = default!; //backmen: job non-standart spawnpoint

private bool _randomizeCharacters;

private Dictionary<SpawnPriorityPreference, Action<PlayerSpawningEvent>> _spawnerCallbacks = new();
Expand Down Expand Up @@ -84,6 +86,8 @@ public override void Initialize()

var ev = new PlayerSpawningEvent(job, profile, station);

_fugitiveSystem.HandlePlayerSpawning(ev); //backmen: job non-standart spawnpoint

if (station != null && profile != null)
{
/// Try to call the character's preferred spawner first.
Expand Down

0 comments on commit 5572002

Please sign in to comment.