From 279bda935fa21ba9c5ed7e2fdf0f166ce8f37ad8 Mon Sep 17 00:00:00 2001 From: Finket Date: Mon, 6 Nov 2023 17:11:28 +0200 Subject: [PATCH] Outline fixes and address some upstream refactor conflicts --- .../ShadowkinBlackeyeTraitComponent.cs | 2 +- .../ShadowkinDarkSwapPowerComponent.cs | 4 +- .../Components/ShadowkinLightComponent.cs | 2 +- .../Components/ShadowkinRestPowerComponent.cs | 4 +- .../ShadowkinTeleportPowerComponent.cs | 4 +- .../Systems/ShadowkinPowerSystem.DarkSwap.cs | 23 +++-- .../Systems/ShadowkinPowerSystem.Rest.cs | 10 ++- .../Systems/ShadowkinPowerSystem.Teleport.cs | 8 +- .../Shadowkin/Systems/ShadowkinSystem.cs | 4 +- .../SimpleStation14/Magic/shadowkin.yml | 84 ++++++++++--------- 10 files changed, 82 insertions(+), 63 deletions(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinBlackeyeTraitComponent.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinBlackeyeTraitComponent.cs index 4946971df8..13a4010f9b 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinBlackeyeTraitComponent.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinBlackeyeTraitComponent.cs @@ -1,7 +1,7 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components; [RegisterComponent] -public sealed class ShadowkinBlackeyeTraitComponent : Component +public sealed partial class ShadowkinBlackeyeTraitComponent : Component { } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinDarkSwapPowerComponent.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinDarkSwapPowerComponent.cs index 68333a32cd..6ede3ec25f 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinDarkSwapPowerComponent.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinDarkSwapPowerComponent.cs @@ -1,7 +1,7 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components; [RegisterComponent] -public sealed class ShadowkinDarkSwapPowerComponent : Component +public sealed partial class ShadowkinDarkSwapPowerComponent : Component { - + public EntityUid? ActionShadowkinDarkSwap { get; set; } } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinLightComponent.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinLightComponent.cs index 33ba441947..f96c48a018 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinLightComponent.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinLightComponent.cs @@ -1,7 +1,7 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components; [RegisterComponent] -public sealed class ShadowkinLightComponent : Component +public sealed partial class ShadowkinLightComponent : Component { [ViewVariables(VVAccess.ReadOnly)] public EntityUid AttachedEntity = EntityUid.Invalid; diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinRestPowerComponent.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinRestPowerComponent.cs index f485136b5e..e25640fb11 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinRestPowerComponent.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinRestPowerComponent.cs @@ -1,8 +1,10 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components; [RegisterComponent] -public sealed class ShadowkinRestPowerComponent : Component +public sealed partial class ShadowkinRestPowerComponent : Component { [ViewVariables(VVAccess.ReadOnly)] public bool IsResting = false; + + public EntityUid? ActionShadowkinRest { get; set; } } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinTeleportPowerComponent.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinTeleportPowerComponent.cs index 8643b4a401..eca292667a 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinTeleportPowerComponent.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Components/ShadowkinTeleportPowerComponent.cs @@ -3,7 +3,7 @@ namespace Content.Server.SimpleStation14.Species.Shadowkin.Components; [RegisterComponent] -public sealed class ShadowkinTeleportPowerComponent : Component +public sealed partial class ShadowkinTeleportPowerComponent : Component { - + public EntityUid? ActionShadowkinTeleport { get; set; } } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs index 1eeab47d39..8e6fcee028 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs @@ -4,10 +4,10 @@ using Content.Server.SimpleStation14.Species.Shadowkin.Events; using Content.Server.Visible; using Content.Shared.Actions; -using Content.Shared.Actions.ActionTypes; using Content.Shared.CombatMode.Pacification; using Content.Shared.Cuffs.Components; using Content.Shared.Damage.Systems; +using Content.Shared.Ghost; using Content.Shared.SimpleStation14.Species.Shadowkin.Components; using Content.Shared.SimpleStation14.Species.Shadowkin.Events; using Content.Shared.Stealth; @@ -47,12 +47,14 @@ public override void Initialize() private void Startup(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, new InstantAction(_prototype.Index("ShadowkinDarkSwap")), null); + var componentActionShadowkinDarkSwap = component.ActionShadowkinDarkSwap; + _actions.AddAction(uid, ref componentActionShadowkinDarkSwap, "ActionShadowkinDarkSwap"); + // _actions.AddAction(uid, "ActionShadowkinDarkSwap"); } private void Shutdown(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, new InstantAction(_prototype.Index("ShadowkinDarkSwap"))); + _actions.RemoveAction(uid, component.ActionShadowkinDarkSwap); } @@ -87,6 +89,7 @@ private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ); _magic.Speak(args, false); } + public void SetDarkened( EntityUid performer, bool addComp, @@ -128,12 +131,14 @@ public void SetDarkened( if (args != null) args.Handled = true; } + private void OnInvisStartup(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentStartup args) { EnsureComp(uid); if (component.Invisible) SetCanSeeInvisibility(uid, true); } + private void OnInvisShutdown(EntityUid uid, ShadowkinDarkSwappedComponent component, ComponentShutdown args) { RemComp(uid); @@ -149,15 +154,17 @@ private void OnInvisShutdown(EntityUid uid, ShadowkinDarkSwappedComponent compon } component.DarkenedLights.Clear(); } + + // Commented out eye and ghost stuff until ported public void SetCanSeeInvisibility(EntityUid uid, bool set) { var visibility = _entity.EnsureComponent(uid); if (set) { - if (_entity.TryGetComponent(uid, out EyeComponent? eye)) + /*if (_entity.TryGetComponent(uid, out EyeComponent? eye)) { eye.VisibilityMask |= (uint) VisibilityFlags.DarkSwapInvisibility; - } + }*/ _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.Normal, false); _visibility.RefreshVisibility(uid); @@ -166,10 +173,10 @@ public void SetCanSeeInvisibility(EntityUid uid, bool set) } else { - if (_entity.TryGetComponent(uid, out EyeComponent? eye)) + /*if (_entity.TryGetComponent(uid, out EyeComponent? eye)) { - eye.VisibilityMask &= ~(uint) VisibilityFlags.DarkSwapInvisibility; - } + // eye.VisibilityMask &= ~(uint) VisibilityFlags.DarkSwapInvisibility; + }*/ _visibility.RemoveLayer(uid, visibility, (int) VisibilityFlags.DarkSwapInvisibility, false); _visibility.AddLayer(uid, visibility, (int) VisibilityFlags.Normal, false); _visibility.RefreshVisibility(uid); diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs index d2ff89af3c..edc26f42eb 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs @@ -1,7 +1,6 @@ using Content.Server.SimpleStation14.Species.Shadowkin.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; using Content.Shared.Actions; -using Content.Shared.Actions.ActionTypes; using Content.Shared.Bed.Sleep; using Content.Shared.Cuffs.Components; using Content.Shared.SimpleStation14.Species.Shadowkin.Components; @@ -29,12 +28,13 @@ public override void Initialize() private void OnStartup(EntityUid uid, ShadowkinRestPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, new InstantAction(_prototype.Index("ShadowkinRest")), null); + var componentActionShadowkinRest = component.ActionShadowkinRest; + _actions.AddAction(uid, ref componentActionShadowkinRest, "ActionShadowkinRest"); } private void OnShutdown(EntityUid uid, ShadowkinRestPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, new InstantAction(_prototype.Index("ShadowkinRest"))); + _actions.RemoveAction(uid, component.ActionShadowkinRest); } private void Rest(EntityUid uid, ShadowkinRestPowerComponent component, ShadowkinRestEvent args) @@ -57,7 +57,9 @@ private void Rest(EntityUid uid, ShadowkinRestPowerComponent component, Shadowki // Sleepy time _entity.EnsureComponent(args.Performer); // No waking up normally (it would do nothing) - _actions.RemoveAction(args.Performer, new InstantAction(_prototype.Index("Wake"))); + // Not sure what needs to be done here with the refactor + // _actions.RemoveAction(args.Performer, component.WakeAction); // ?? + // _actions.RemoveAction(args.Performer, new InstantAction(_prototype.Index("Wake"))); _power.TryAddMultiplier(args.Performer, 1.5f); // No action cooldown diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs index 094c2ab8f0..a5d260aae1 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs @@ -3,7 +3,6 @@ using Content.Server.SimpleStation14.Species.Shadowkin.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; using Content.Shared.Actions; -using Content.Shared.Actions.ActionTypes; using Content.Shared.Cuffs.Components; using Content.Shared.Damage.Systems; using Content.Shared.Pulling.Components; @@ -38,12 +37,15 @@ public override void Initialize() private void Startup(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport")), null); + var componentActionShadowkinTeleport = component.ActionShadowkinTeleport; + _actions.AddAction(uid, ref componentActionShadowkinTeleport, "ActionShadowkinTeleport"); + // _actions.AddAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport")), null); } private void Shutdown(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport"))); + _actions.RemoveAction(uid, component.ActionShadowkinTeleport); + // _actions.RemoveAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport"))); } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs index 12d89f6ab3..288b03c1e7 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs @@ -1,6 +1,6 @@ using System.Numerics; using Content.Server.Mind; -using Content.Server.Mind.Components; +using Content.Shared.Mind.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; using Content.Shared.Bed.Sleep; using Content.Shared.Cuffs.Components; @@ -100,7 +100,7 @@ public override void Update(float frameTime) } // Don't update things for ssd shadowkin - if (!_entity.System().TryGetMind(uid, out var mind) || + if (!_entity.System().TryGetMind(uid, out var mindId, out var mind) || mind.Session == null) continue; diff --git a/Resources/Prototypes/SimpleStation14/Magic/shadowkin.yml b/Resources/Prototypes/SimpleStation14/Magic/shadowkin.yml index 2df3454d7a..07ff9babb2 100644 --- a/Resources/Prototypes/SimpleStation14/Magic/shadowkin.yml +++ b/Resources/Prototypes/SimpleStation14/Magic/shadowkin.yml @@ -1,47 +1,53 @@ -- type: worldTargetAction - id: ShadowkinTeleport +- type: entity + id: ActionShadowkinTeleport name: action-name-shadowkin-teleport description: action-description-shadowkin-teleport - useDelay: 5 - range: 32 - itemIconStyle: NoItem - checkCanAccess: true - repeat: true - priority: -20 - icon: - sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi - state: teleport - serverEvent: !type:ShadowkinTeleportEvent - powerCost: 40 - staminaCost: 20 - speech: action-description-shadowkin-teleport + components: + - type: WorldTargetAction + useDelay: 5 + range: 32 + itemIconStyle: NoItem + checkCanAccess: true + repeat: true + priority: -20 + icon: + sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi + state: teleport + serverEvent: !type:ShadowkinTeleportEvent + powerCost: 40 + staminaCost: 20 + speech: action-description-shadowkin-teleport -- type: instantAction - id: ShadowkinDarkSwap +- type: entity + id: ActionShadowkinDarkSwap name: action-name-shadowkin-darkswap description: action-description-shadowkin-darkswap - useDelay: 15 - itemIconStyle: NoItem - priority: -21 - icon: - sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi - state: darkswap - serverEvent: !type:ShadowkinDarkSwapEvent - powerCostOn: 60 - powerCostOff: 45 - staminaCostOn: 25 - staminaCostOff: 25 - speech: action-description-shadowkin-darkswap + components: + - type: InstantAction + useDelay: 15 + itemIconStyle: NoItem + priority: -21 + icon: + sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi + state: darkswap + serverEvent: !type:ShadowkinDarkSwapEvent + powerCostOn: 60 + powerCostOff: 45 + staminaCostOn: 25 + staminaCostOff: 25 + speech: action-description-shadowkin-darkswap -- type: instantAction - id: ShadowkinRest +- type: entity + id: ActionShadowkinRest name: action-name-shadowkin-rest description: action-description-shadowkin-rest - useDelay: 60 - itemIconStyle: NoItem - priority: -22 - icon: - sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi - state: rest - checkCanInteract: false - serverEvent: !type:ShadowkinRestEvent + components: + - type: InstantAction + useDelay: 60 + itemIconStyle: NoItem + priority: -22 + icon: + sprite: SimpleStation14/Interface/Actions/shadowkin_icons.rsi + state: rest + checkCanInteract: false + serverEvent: !type:ShadowkinRestEvent