Allow non-humanoid roles (#9604)
This commit is contained in:
@@ -6,7 +6,7 @@ using Content.Server.Hands.Systems;
|
||||
using Content.Server.PDA;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Inventory;
|
||||
@@ -20,6 +20,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
||||
namespace Content.Server.Station.Systems;
|
||||
|
||||
/// <summary>
|
||||
@@ -92,6 +93,15 @@ public sealed class StationSpawningSystem : EntitySystem
|
||||
HumanoidCharacterProfile? profile,
|
||||
EntityUid? station)
|
||||
{
|
||||
// If we're not spawning a humanoid, we're gonna exit early without doing all the humanoid stuff.
|
||||
if (job?.JobEntity != null)
|
||||
{
|
||||
var jobEntity = EntityManager.SpawnEntity(job.JobEntity, coordinates);
|
||||
MakeSentientCommand.MakeSentient(jobEntity, EntityManager);
|
||||
DoJobSpecials(job, jobEntity);
|
||||
return jobEntity;
|
||||
}
|
||||
|
||||
var entity = EntityManager.SpawnEntity(
|
||||
_prototypeManager.Index<SpeciesPrototype>(profile?.Species ?? SpeciesManager.DefaultSpecies).Prototype,
|
||||
coordinates);
|
||||
@@ -114,12 +124,17 @@ public sealed class StationSpawningSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
DoJobSpecials(job, entity);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private void DoJobSpecials(Job? job, EntityUid entity)
|
||||
{
|
||||
foreach (var jobSpecial in job?.Prototype.Special ?? Array.Empty<JobSpecial>())
|
||||
{
|
||||
jobSpecial.AfterEquip(entity);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user