Fixed cyborgs with the StartIonStormedComponent (which is just the Derelict Cyborg right now) not showing up as 'antag' in the admin player overlay.
This commit is contained in:
@@ -51,6 +51,8 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
||||
SubscribeLocalEvent<SiliconLawProviderComponent, GotEmaggedEvent>(OnEmagLawsAdded);
|
||||
SubscribeLocalEvent<EmagSiliconLawComponent, MindAddedMessage>(OnEmagMindAdded);
|
||||
SubscribeLocalEvent<EmagSiliconLawComponent, MindRemovedMessage>(OnEmagMindRemoved);
|
||||
SubscribeLocalEvent<StartIonStormedComponent, MindAddedMessage>(OnStartIonStormedMindAdded);
|
||||
SubscribeLocalEvent<StartIonStormedComponent, MindRemovedMessage>(OnStartIonStormedMindRemoved);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, SiliconLawBoundComponent component, MapInitEvent args)
|
||||
@@ -184,6 +186,31 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
||||
_roles.MindAddRole(mindId, new SubvertedSiliconRoleComponent { PrototypeId = component.AntagonistRole });
|
||||
}
|
||||
|
||||
private void OnStartIonStormedMindAdded(EntityUid uid, StartIonStormedComponent component, MindAddedMessage args)
|
||||
{
|
||||
if (HasComp<StartIonStormedComponent>(uid))
|
||||
EnsureStartIonStormedRole(uid, component);
|
||||
}
|
||||
|
||||
private void OnStartIonStormedMindRemoved(EntityUid uid, StartIonStormedComponent component, MindRemovedMessage args)
|
||||
{
|
||||
if (component.AntagonistRole == null)
|
||||
return;
|
||||
|
||||
_roles.MindTryRemoveRole<SubvertedSiliconRoleComponent>(args.Mind);
|
||||
}
|
||||
|
||||
private void EnsureStartIonStormedRole(EntityUid uid, StartIonStormedComponent component)
|
||||
{
|
||||
if (component.AntagonistRole == null || !_mind.TryGetMind(uid, out var mindId, out _))
|
||||
return;
|
||||
|
||||
if (_roles.MindHasRole<SubvertedSiliconRoleComponent>(mindId))
|
||||
return;
|
||||
|
||||
_roles.MindAddRole(mindId, new SubvertedSiliconRoleComponent { PrototypeId = component.AntagonistRole });
|
||||
}
|
||||
|
||||
public SiliconLawset GetLaws(EntityUid uid, SiliconLawBoundComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
using Content.Shared.Roles;//Used
|
||||
using Robust.Shared.Prototypes;//
|
||||
|
||||
namespace Content.Shared.Silicons.Laws.Components;
|
||||
|
||||
/// <summary>
|
||||
@@ -11,4 +14,11 @@ public sealed partial class StartIonStormedComponent : Component
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public int IonStormAmount = 1;
|
||||
|
||||
/// <summary>
|
||||
/// A role given to entities with this component when they are thing-that-is-not-emagged.
|
||||
/// Mostly just for admin purposes.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public ProtoId<AntagPrototype>? AntagonistRole = "SubvertedSilicon";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user