From 64c81f5e3163f0ddb77ccc327070c2058beebabe Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 13:55:07 -0700 Subject: [PATCH 1/9] undarkswap critical/dead shadowkin --- .../Species/Shadowkin/Systems/ShadowkinSystem.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs index 93c9bae06b..6e55a692df 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs @@ -89,14 +89,21 @@ public override void Update(float frameTime) // Update power level for all shadowkin while (query.MoveNext(out var uid, out var shadowkin)) { - // Skip if the shadowkin is dead or catatonic + // Ensure dead or critical shadowkin aren't swapped, skip them if (_mobState.IsDead(uid) || - !_entity.System().TryGetMind(uid, out var mind) || + _mobState.IsCritical(uid)) + { + _entity.RemoveComponent(uid); + continue; + } + + // Don't update things for ssd shadowkin + if (!_entity.System().TryGetMind(uid, out var mind) || mind.Session == null) continue; - var oldPowerLevel = _power.GetLevelName(shadowkin.PowerLevel); + var oldPowerLevel = _power.GetLevelName(shadowkin.PowerLevel); _power.TryUpdatePowerLevel(uid, frameTime); if (oldPowerLevel != _power.GetLevelName(shadowkin.PowerLevel)) From d845266d5aa09b6956e7309c20154b925473c6c4 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 14:09:32 -0700 Subject: [PATCH 2/9] redefine actions, innate powers --- .../Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs | 8 ++------ .../Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs | 8 ++------ .../Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs index 9e4caad796..329db5faa2 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs @@ -30,14 +30,10 @@ public sealed class ShadowkinDarkSwapSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly MagicSystem _magic = default!; - private InstantAction _action = default!; - public override void Initialize() { base.Initialize(); - _action = new InstantAction(_prototype.Index("ShadowkinDarkSwap")); - SubscribeLocalEvent(Startup); SubscribeLocalEvent(Shutdown); @@ -50,12 +46,12 @@ public override void Initialize() private void Startup(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, _action, uid); + _actions.AddAction(uid, new InstantAction(_prototype.Index("ShadowkinDarkSwap")), null); } private void Shutdown(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, _action); + _actions.RemoveAction(uid, new InstantAction(_prototype.Index("ShadowkinDarkSwap"))); } diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs index 7605edcbeb..59ef6ff60a 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs @@ -15,14 +15,10 @@ public sealed class ShadowkinRestSystem : EntitySystem [Dependency] private readonly SharedActionsSystem _actions = default!; [Dependency] private readonly ShadowkinPowerSystem _power = default!; - private InstantAction _action = default!; - public override void Initialize() { base.Initialize(); - _action = new InstantAction(_prototype.Index("ShadowkinRest")); - SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(OnShutdown); @@ -32,12 +28,12 @@ public override void Initialize() private void OnStartup(EntityUid uid, ShadowkinRestPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, _action, uid); + _actions.AddAction(uid, new InstantAction(_prototype.Index("ShadowkinRest")), null); } private void OnShutdown(EntityUid uid, ShadowkinRestPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, _action); + _actions.RemoveAction(uid, new InstantAction(_prototype.Index("ShadowkinRest"))); } private void Rest(EntityUid uid, ShadowkinRestPowerComponent component, ShadowkinRestEvent args) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs index b21c27aa92..19cffecb1c 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs @@ -24,14 +24,10 @@ public sealed class ShadowkinTeleportSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly MagicSystem _magic = default!; - private WorldTargetAction _action = default!; - public override void Initialize() { base.Initialize(); - _action = new WorldTargetAction(_prototype.Index("ShadowkinTeleport")); - SubscribeLocalEvent(Startup); SubscribeLocalEvent(Shutdown); @@ -41,12 +37,12 @@ public override void Initialize() private void Startup(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentStartup args) { - _actions.AddAction(uid, _action, uid); + _actions.AddAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport")), null); } private void Shutdown(EntityUid uid, ShadowkinTeleportPowerComponent component, ComponentShutdown args) { - _actions.RemoveAction(uid, _action); + _actions.RemoveAction(uid, new WorldTargetAction(_prototype.Index("ShadowkinTeleport"))); } From 6fb0e14f69a42ae1b2effe87620c908d9ce2fef7 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 14:46:26 -0700 Subject: [PATCH 3/9] cuffs revoke ability to use powers --- .../Systems/ShadowkinPowerSystem.DarkSwap.cs | 11 +++++++++++ .../Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs | 8 ++++++++ .../Systems/ShadowkinPowerSystem.Teleport.cs | 10 ++++++++-- .../Species/Shadowkin/Systems/ShadowkinSystem.cs | 7 +++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs index 329db5faa2..186552508c 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.DarkSwap.cs @@ -6,6 +6,7 @@ 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.SimpleStation14.Species.Shadowkin.Components; using Content.Shared.SimpleStation14.Species.Shadowkin.Events; @@ -57,6 +58,16 @@ private void Shutdown(EntityUid uid, ShadowkinDarkSwapPowerComponent component, private void DarkSwap(EntityUid uid, ShadowkinDarkSwapPowerComponent component, ShadowkinDarkSwapEvent args) { + // Need power to drain power + if (!_entity.HasComponent(args.Performer)) + return; + + // Don't activate abilities if handcuffed + // TODO: Something like the Psionic Headcage to disable powers for Shadowkin + if (_entity.HasComponent(args.Performer)) + return; + + var hasComp = _entity.HasComponent(args.Performer); SetDarkened( diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs index 59ef6ff60a..f838fe2564 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Rest.cs @@ -3,6 +3,7 @@ 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; using Robust.Shared.Prototypes; @@ -38,9 +39,16 @@ private void OnShutdown(EntityUid uid, ShadowkinRestPowerComponent component, Co private void Rest(EntityUid uid, ShadowkinRestPowerComponent component, ShadowkinRestEvent args) { + // Need power to modify power if (!_entity.HasComponent(args.Performer)) return; + // Rest is a funny ability, keep it :) + // // Don't activate abilities if handcuffed + // if (_entity.HasComponent(args.Performer)) + // return; + + // Now doing what you weren't before component.IsResting = !component.IsResting; diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs index 19cffecb1c..870703d935 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Teleport.cs @@ -4,6 +4,7 @@ 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; using Content.Shared.SimpleStation14.Species.Shadowkin.Components; @@ -48,8 +49,13 @@ private void Shutdown(EntityUid uid, ShadowkinTeleportPowerComponent component, private void Teleport(EntityUid uid, ShadowkinTeleportPowerComponent component, ShadowkinTeleportEvent args) { - if (args.Handled || - !_entity.TryGetComponent(args.Performer, out var comp)) + // Need power to drain power + if (!_entity.TryGetComponent(args.Performer, out var comp)) + return; + + // Don't activate abilities if handcuffed + // TODO: Something like the Psionic Headcage to disable powers for Shadowkin + if (_entity.HasComponent(args.Performer)) return; diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs index 6e55a692df..6710cbebd2 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Mind; using Content.Server.Mind.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; +using Content.Shared.Cuffs.Components; using Content.Shared.Examine; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; @@ -114,6 +115,12 @@ public override void Update(float frameTime) // I can't figure out how to get this to go to the 100% filled state in the above if statement 😢 _power.UpdateAlert(uid, true, shadowkin.PowerLevel); + + // Don't randomly activate abilities if handcuffed + // TODO: Something like the Psionic Headcage to disable powers for Shadowkin + if (_entity.HasComponent(uid)) + continue; + #region MaxPower // Check if they're at max power if (shadowkin.PowerLevel >= ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Max]) From 7e7e0ce5cca9b5130d2daf203a6ec4a3ebf1f855 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:08:27 -0700 Subject: [PATCH 4/9] lights that don't require power will be affected by Darkening --- .../Shadowkin/Systems/ShadowkinPowerSystem.Darken.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Darken.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Darken.cs index 14b263ae64..c1f3952cf4 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Darken.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinPowerSystem.Darken.cs @@ -78,7 +78,7 @@ public override void Update(float frameTime) if (!_entity.TryGetComponent(light, out ShadowkinLightComponent? shadowkinLight)) continue; // Not powered, undo changes - if (!_entity.TryGetComponent(light, out PoweredLightComponent? powered) || !powered.On) + if (_entity.TryGetComponent(light, out PoweredLightComponent? powered) && !powered.On) { ResetLight(pointLight, shadowkinLight); continue; @@ -98,10 +98,10 @@ public override void Update(float frameTime) shadowkin.DarkenedLights.Remove(light); continue; } - // 10% chance to remove the attached entity so it can become another Shadowkin's light + // 3% chance to remove the attached entity so it can become another Shadowkin's light if (shadowkinLight.AttachedEntity == uid) { - if (_random.Prob(0.1f)) + if (_random.Prob(0.03f)) shadowkinLight.AttachedEntity = EntityUid.Invalid; } From 81a26766f33d1ee9fde8333ddae229e7ca9570cf Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:08:48 -0700 Subject: [PATCH 5/9] more wallmounted lights affected by Darkening --- .../Prototypes/Entities/Structures/Lighting/base_lighting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml b/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml index 78f4617d46..79c241e313 100644 --- a/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml +++ b/Resources/Prototypes/Entities/Structures/Lighting/base_lighting.yml @@ -29,6 +29,7 @@ - state: on map: ["enum.PoweredLightLayers.Base"] state: on + - type: ShadowkinLight - type: PointLight radius: 10 energy: 0.8 @@ -107,7 +108,6 @@ components: - type: Sprite state: off - - type: ShadowkinLight - type: PointLight enabled: true - type: PoweredLight From 3ef3e2e8f36400879509cc306207e3467973f648 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:09:00 -0700 Subject: [PATCH 6/9] PDA affected by Darkening --- Resources/Prototypes/Entities/Objects/Devices/pda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml index 879e1ad3ea..90d933565a 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml @@ -57,6 +57,7 @@ icon: { sprite: Objects/Tools/flashlight.rsi, state: flashlight } iconOn: Objects/Tools/flashlight.rsi/flashlight-on.png event: !type:ToggleActionEvent + - type: ShadowkinLight - type: PointLight enabled: false radius: 1.5 From 2b5c3f82ee228ac3285e638c4771558c5f75096c Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:10:34 -0700 Subject: [PATCH 7/9] flashlights affected by Darkening --- Resources/Prototypes/Entities/Objects/Tools/flashlights.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml index f743ca485f..6d5b2dc7c4 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml @@ -69,6 +69,7 @@ map: [ "light" ] - type: Item sprite: Objects/Tools/flashlight.rsi + - type: ShadowkinLight - type: PointLight enabled: false mask: /Textures/Effects/LightMasks/cone.png From fc91884d09ba4f1d923714ea0a95c3f9eb04c91e Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:12:45 -0700 Subject: [PATCH 8/9] lanterns and floodlights affected by Darkening --- Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml index 90c377f4e7..503b11f2f8 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml @@ -45,6 +45,7 @@ sprite: Objects/Misc/Lights/lights.rsi size: 20 heldPrefix: off + - type: ShadowkinLight - type: PointLight enabled: false radius: 3 From ac854dd502307ac39aafd8ec07aaf8850ee39250 Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT Date: Fri, 28 Jul 2023 15:43:30 -0700 Subject: [PATCH 9/9] don't sleep so hard the Shadowkin wake up --- .../Species/Shadowkin/Systems/ShadowkinSystem.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs index 6710cbebd2..1d59b786b4 100644 --- a/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs +++ b/Content.Server/SimpleStation14/Species/Shadowkin/Systems/ShadowkinSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Mind; using Content.Server.Mind.Components; using Content.Server.SimpleStation14.Species.Shadowkin.Events; +using Content.Shared.Bed.Sleep; using Content.Shared.Cuffs.Components; using Content.Shared.Examine; using Content.Shared.IdentityManagement; @@ -163,7 +164,9 @@ public override void Update(float frameTime) ( ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Tired] + ShadowkinComponent.PowerThresholds[ShadowkinPowerThreshold.Okay] - ) / 2f + ) / 2f && + // Don't sleep if asleep + !_entity.HasComponent(uid) ) { // If so, start the timer