Skip to content

Commit b5c3a39

Browse files
committed
guh
1 parent 4611d54 commit b5c3a39

3 files changed

Lines changed: 19 additions & 32 deletions

File tree

‎Content.Server/DeltaV/Ghost/Roles/Components/GhostRoleCharacterSpawnerComponent.cs‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace Content.Server.Ghost.Roles.Components
1+
using Content.Shared.Roles;
2+
using Robust.Shared.Prototypes;
3+
4+
namespace Content.Server.Ghost.Roles.Components
25
{
36
/// <summary>
47
/// Allows a ghost to take this role, spawning their selected character.
@@ -17,18 +20,12 @@ public sealed partial class GhostRoleCharacterSpawnerComponent : Component
1720
public int CurrentTakeovers = 0;
1821

1922
[DataField]
20-
public string OutfitPrototype = "PassengerGear";
21-
22-
/// <summary>
23-
/// Whether to give the MindShield and AntagImmune components on spawn.
24-
/// </summary>
25-
[DataField]
26-
public bool MindShield;
23+
public ProtoId<StartingGearPrototype> OutfitPrototype = "PassengerGear";
2724

2825
/// <summary>
29-
/// Whether to give the TargetObjectiveImmune component on spawn.
26+
/// Components to give on spawn.
3027
/// </summary>
3128
[DataField]
32-
public bool TargetObjectiveImmune;
29+
public ComponentRegistry Components = new();
3330
}
3431
}

‎Content.Server/DeltaV/Ghost/Roles/GhostRoleSystem.Character.cs‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
using Content.Server.Administration.Commands;
2-
using Content.Server.Antag.Components;
32
using Content.Server.Ghost.Roles.Components;
43
using Content.Server.Ghost.Roles.Events;
5-
using Content.Server.Objectives.Components;
64
using Content.Server.Preferences.Managers;
75
using Content.Server.Station.Systems;
86
using Content.Shared.Mind.Components;
9-
using Content.Shared.Mindshield.Components;
107
using Content.Shared.Preferences;
11-
using Content.Shared.Roles;
128

139
namespace 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
{

‎Resources/Prototypes/DeltaV/Entities/Markers/Spawners/ghost_roles.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
suffix: mindshielded, player character
2525
components:
2626
- type: GhostRoleCharacterSpawner
27-
mindShield: true
27+
components:
28+
- MindShield
2829

2930
- type: entity
3031
parent: SpawnPointPlayerCharacter
@@ -33,8 +34,10 @@
3334
suffix: mindshielded, KillObjectiveImmune, player character
3435
components:
3536
- type: GhostRoleCharacterSpawner
36-
mindShield: true
37-
targetObjectiveImmune: true
37+
components:
38+
- MindShield
39+
- AntagImmune
40+
- TargetObjectiveImmune
3841

3942
- type: entity # Part of ListeningPost
4043
categories: [ HideSpawnMenu, Spawner ]

0 commit comments

Comments
 (0)