Skip to content

Commit 1e0c4f3

Browse files
authored
the return of player character spawners (feat. mindshield bullshit) (#2072)
* aaaaaaaaaaa * guh * epic fail * fuck it we ball
1 parent c10de70 commit 1e0c4f3

3 files changed

Lines changed: 47 additions & 18 deletions

File tree

Lines changed: 14 additions & 5 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.
@@ -7,16 +10,22 @@
710
[Access(typeof(GhostRoleSystem))]
811
public sealed partial class GhostRoleCharacterSpawnerComponent : Component
912
{
10-
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
13+
[DataField]
1114
public bool DeleteOnSpawn = true;
1215

13-
[ViewVariables(VVAccess.ReadWrite)] [DataField("availableTakeovers")]
16+
[DataField]
1417
public int AvailableTakeovers = 1;
1518

1619
[ViewVariables]
1720
public int CurrentTakeovers = 0;
1821

19-
[ViewVariables(VVAccess.ReadWrite)] [DataField("outfitPrototype")]
20-
public string OutfitPrototype = "PassengerGear";
22+
[DataField]
23+
public ProtoId<StartingGearPrototype> OutfitPrototype = "PassengerGear";
24+
25+
/// <summary>
26+
/// Components to give on spawn.
27+
/// </summary>
28+
[DataField]
29+
public ComponentRegistry AddedComponents = new();
2130
}
2231
}

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using Content.Server.Station.Systems;
66
using Content.Shared.Mind.Components;
77
using Content.Shared.Preferences;
8-
using Content.Shared.Roles;
9-
using Robust.Shared.Prototypes;
108

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

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
- type: entity
2-
categories: [ HideSpawnMenu, Spawner ]
2+
categories: [ Spawner ]
33
parent: MarkerBase
44
id: SpawnPointPlayerCharacter
55
name: ghost role spawn point
6-
suffix: player character, DO NOT MAP
6+
suffix: player character
77
components:
88
- type: GhostRole
99
name: Roleplay Ghost Role
10-
description: Placeholder
11-
rules: Placeholder
10+
description: This is a custom event ghost role.
11+
rules: ghost-role-component-default-rules
1212
- type: GhostRoleCharacterSpawner
1313
- type: Sprite
1414
sprite: Markers/jobs.rsi
@@ -17,6 +17,28 @@
1717
- sprite: Mobs/Species/Human/parts.rsi
1818
state: full
1919

20+
- type: entity
21+
parent: SpawnPointPlayerCharacter
22+
id: SpawnPointPlayerCharacterMindShield
23+
name: ghost role spawn point
24+
suffix: mindshielded, player character
25+
components:
26+
- type: GhostRoleCharacterSpawner
27+
addedComponents:
28+
- type: MindShield
29+
30+
- type: entity
31+
parent: SpawnPointPlayerCharacter
32+
id: SpawnPointPlayerCharacterTargetImmune
33+
name: ghost role spawn point
34+
suffix: mindshielded, KillObjectiveImmune, player character
35+
components:
36+
- type: GhostRoleCharacterSpawner
37+
addedComponents:
38+
- type: MindShield
39+
- type: AntagImmune
40+
- type: TargetObjectiveImmune
41+
2042
- type: entity # Part of ListeningPost
2143
categories: [ HideSpawnMenu, Spawner ]
2244
parent: BaseAntagSpawner

0 commit comments

Comments
 (0)