11using Content . Server . Administration . Commands ;
2- using Content . Server . Antag . Components ;
32using Content . Server . Ghost . Roles . Components ;
43using Content . Server . Ghost . Roles . Events ;
5- using Content . Server . Objectives . Components ;
64using Content . Server . Preferences . Managers ;
75using Content . Server . Station . Systems ;
86using Content . Shared . Mind . Components ;
9- using Content . Shared . Mindshield . Components ;
107using Content . Shared . Preferences ;
11- using Content . Shared . Roles ;
128
139namespace Content . Server . Ghost . Roles
1410{
@@ -17,9 +13,12 @@ public sealed partial class GhostRoleSystem
1713 [ Dependency ] private readonly IServerPreferencesManager _prefs = default ! ;
1814 [ Dependency ] private readonly IEntityManager _entityManager = default ! ;
1915
20- private void OnSpawnerTakeCharacter ( EntityUid uid , GhostRoleCharacterSpawnerComponent component ,
16+ private void OnSpawnerTakeCharacter ( Entity < GhostRoleCharacterSpawnerComponent > ent ,
2117 ref TakeGhostRoleEvent args )
2218 {
19+ var uid = ent . Owner ;
20+ var component = ent . Comp ;
21+
2322 if ( ! TryComp ( uid , out GhostRoleComponent ? ghostRole ) ||
2423 ghostRole . Taken )
2524 {
@@ -33,28 +32,16 @@ private void OnSpawnerTakeCharacter( EntityUid uid, GhostRoleCharacterSpawnerCom
3332 . SpawnPlayerMob ( Transform ( uid ) . Coordinates , null , character , null ) ;
3433 _transform . AttachToGridOrMap ( mob ) ;
3534
36- string ? outfit = null ;
37- if ( _prototype . TryIndex < StartingGearPrototype > ( component . OutfitPrototype , out var outfitProto ) )
38- outfit = outfitProto . ID ;
39-
4035 var spawnedEvent = new GhostRoleSpawnerUsedEvent ( uid , mob ) ;
4136 RaiseLocalEvent ( mob , spawnedEvent ) ;
4237
4338 EnsureComp < MindContainerComponent > ( mob ) ;
4439
4540 GhostRoleInternalCreateMindAndTransfer ( args . Player , uid , mob , ghostRole ) ;
4641
47- if ( outfit != null )
48- SetOutfitCommand . SetOutfit ( mob , outfit , _entityManager ) ;
49-
50- if ( component . MindShield )
51- {
52- EnsureComp < MindShieldComponent > ( mob ) ;
53- EnsureComp < AntagImmuneComponent > ( mob ) ;
54- }
42+ SetOutfitCommand . SetOutfit ( mob , component . OutfitPrototype , _entityManager ) ;
5543
56- if ( component . TargetObjectiveImmune )
57- EnsureComp < TargetObjectiveImmuneComponent > ( mob ) ;
44+ EntityManager . AddComponents ( mob , component . Components ) ;
5845
5946 if ( ++ component . CurrentTakeovers < component . AvailableTakeovers )
6047 {
0 commit comments