55using Content . Server . Station . Systems ;
66using Content . Shared . Mind . Components ;
77using Content . Shared . Preferences ;
8- using Content . Shared . Roles ;
9- using Robust . Shared . Prototypes ;
108
119namespace Content . Server . Ghost . Roles
1210{
@@ -15,9 +13,12 @@ public sealed partial class GhostRoleSystem
1513 [ Dependency ] private readonly IServerPreferencesManager _prefs = default ! ;
1614 [ Dependency ] private readonly IEntityManager _entityManager = default ! ;
1715
18- private void OnSpawnerTakeCharacter ( EntityUid uid , GhostRoleCharacterSpawnerComponent component ,
16+ private void OnSpawnerTakeCharacter ( Entity < GhostRoleCharacterSpawnerComponent > ent ,
1917 ref TakeGhostRoleEvent args )
2018 {
19+ var uid = ent . Owner ;
20+ var component = ent . Comp ;
21+
2122 if ( ! TryComp ( uid , out GhostRoleComponent ? ghostRole ) ||
2223 ghostRole . Taken )
2324 {
@@ -31,19 +32,16 @@ private void OnSpawnerTakeCharacter( EntityUid uid, GhostRoleCharacterSpawnerCom
3132 . SpawnPlayerMob ( Transform ( uid ) . Coordinates , null , character , null ) ;
3233 _transform . AttachToGridOrMap ( mob ) ;
3334
34- string ? outfit = null ;
35- if ( _prototype . TryIndex < StartingGearPrototype > ( component . OutfitPrototype , out var outfitProto ) )
36- outfit = outfitProto . ID ;
37-
3835 var spawnedEvent = new GhostRoleSpawnerUsedEvent ( uid , mob ) ;
3936 RaiseLocalEvent ( mob , spawnedEvent ) ;
4037
4138 EnsureComp < MindContainerComponent > ( mob ) ;
4239
4340 GhostRoleInternalCreateMindAndTransfer ( args . Player , uid , mob , ghostRole ) ;
4441
45- if ( outfit != null )
46- SetOutfitCommand . SetOutfit ( mob , outfit , _entityManager ) ;
42+ SetOutfitCommand . SetOutfit ( mob , component . OutfitPrototype , _entityManager ) ;
43+
44+ EntityManager . AddComponents ( mob , component . AddedComponents ) ;
4745
4846 if ( ++ component . CurrentTakeovers < component . AvailableTakeovers )
4947 {
0 commit comments