Skip to content

Commit

Permalink
Fix action ECS again and fix action removal
Browse files Browse the repository at this point in the history
  • Loading branch information
vaketola committed Feb 22, 2024
1 parent 030c3c8 commit bd1f7a8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Server.NPC.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Server.SimpleStation14.Species.Shadowkin.Components;
Expand All @@ -17,5 +19,6 @@ public sealed partial class ShadowkinDarkSwapPowerComponent : Component
[DataField("factions", customTypeSerializer: typeof(PrototypeIdListSerializer<NpcFactionPrototype>))]
public List<string> AddedFactions = new() { "ShadowkinDarkFriendly" };

public EntityUid? ActionShadowkinDarkSwap { get; set; }
[DataField("shadowkinDarkSwapActionEntity")]
public EntityUid? ShadowkinDarkSwapActionEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public sealed partial class ShadowkinRestPowerComponent : Component
[ViewVariables(VVAccess.ReadOnly)]
public bool IsResting = false;

public EntityUid? ActionShadowkinRest { get; set; }
[DataField("shadowkinRestActionEntity")]
public EntityUid? ShadowkinRestActionEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components;
[RegisterComponent]
public sealed partial class ShadowkinTeleportPowerComponent : Component
{
public EntityUid? ActionShadowkinTeleport { get; set; }
[DataField("shadowkinTeleportActionEntity")]
public EntityUid? ShadowkinTeleportActionEntity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed class ShadowkinDarkSwapSystem : EntitySystem
[Dependency] private readonly NpcFactionSystem _factions = default!;

[ValidatePrototypeId<EntityPrototype>]
private const string ActionShadowkinDarkSwapId = "ActionShadowkinDarkSwap";
private const string ShadowkinDarkSwapActionId = "ShadowkinDarkSwapAction";

public override void Initialize()
{
Expand All @@ -53,13 +53,12 @@ public override void Initialize()

private void Startup(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentStartup args)
{
var componentActionShadowkinDarkSwap = component.ActionShadowkinDarkSwap;
_actions.AddAction(uid, ref componentActionShadowkinDarkSwap, ActionShadowkinDarkSwapId);
_actions.AddAction(uid, ref component.ShadowkinDarkSwapActionEntity, ShadowkinDarkSwapActionId, uid);
}

private void Shutdown(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentShutdown args)
{
_actions.RemoveAction(uid, component.ActionShadowkinDarkSwap);
_actions.RemoveAction(uid, component.ShadowkinDarkSwapActionEntity);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class ShadowkinRestSystem : EntitySystem
[Dependency] private readonly ShadowkinPowerSystem _power = default!;

[ValidatePrototypeId<EntityPrototype>]
private const string ActionShadowkinRestId = "ActionShadowkinRest";
private const string ShadowkinRestActionId = "ShadowkinRestAction";

public override void Initialize()
{
Expand All @@ -30,13 +30,12 @@ public override void Initialize()

private void OnStartup(EntityUid uid, ShadowkinRestPowerComponent component, ComponentStartup args)
{
var componentActionShadowkinRest = component.ActionShadowkinRest;
_actions.AddAction(uid, ref componentActionShadowkinRest, ActionShadowkinRestId);
_actions.AddAction(uid, ref component.ShadowkinRestActionEntity, ShadowkinRestActionId);
}

private void OnShutdown(EntityUid uid, ShadowkinRestPowerComponent component, ComponentShutdown args)
{
_actions.RemoveAction(uid, component.ActionShadowkinRest);
_actions.RemoveAction(uid, component.ShadowkinRestActionEntity);
}

private void Rest(EntityUid uid, ShadowkinRestPowerComponent component, ShadowkinRestEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class ShadowkinTeleportSystem : EntitySystem
[Dependency] private readonly MagicSystem _magic = default!;

[ValidatePrototypeId<EntityPrototype>]
private const string ActionShadowkinTeleportId = "ActionShadowkinTeleport";
private const string ShadowkinTeleportActionId = "ShadowkinTeleportAction";

public override void Initialize()
{
Expand All @@ -40,13 +40,12 @@ public override void Initialize()

private void Startup(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentStartup args)
{
var componentActionShadowkinTeleport = component.ActionShadowkinTeleport;
_actions.AddAction(uid, ref componentActionShadowkinTeleport, ActionShadowkinTeleportId);
_actions.AddAction(uid, ref component.ShadowkinTeleportActionEntity, ShadowkinTeleportActionId);
}

private void Shutdown(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentShutdown args)
{
_actions.RemoveAction(uid, component.ActionShadowkinTeleport);
_actions.RemoveAction(uid, component.ShadowkinTeleportActionEntity);
}


Expand Down
6 changes: 3 additions & 3 deletions Resources/Prototypes/SimpleStation14/Magic/shadowkin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- type: entity
id: ActionShadowkinTeleport
id: ShadowkinTeleportAction
name: action-name-shadowkin-teleport
description: action-description-shadowkin-teleport
components:
Expand All @@ -19,7 +19,7 @@
speech: action-description-shadowkin-teleport

- type: entity
id: ActionShadowkinDarkSwap
id: ShadowkinDarkSwapAction
name: action-name-shadowkin-darkswap
description: action-description-shadowkin-darkswap
components:
Expand All @@ -38,7 +38,7 @@
speech: action-description-shadowkin-darkswap

- type: entity
id: ActionShadowkinRest
id: ShadowkinRestAction
name: action-name-shadowkin-rest
description: action-description-shadowkin-rest
components:
Expand Down

0 comments on commit bd1f7a8

Please sign in to comment.