From 702bf07b3200c6ffa904c165f63f726b11529a5b Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sat, 9 Nov 2024 19:06:24 +0100 Subject: [PATCH 01/13] Startup --- .../Psionics/Abilities/DarkSwapSystem.cs | 4 +- .../Shadowkin/EtherealStunItemSystem.cs | 3 +- Content.Server/Shadowkin/EtherealSystem.cs | 7 +--- .../Shadowkin/ShadowkinCuffSystem.cs | 29 ------------- Content.Server/Shadowkin/ShadowkinSystem.cs | 42 ++----------------- Content.Shared/Psionics/PsionicComponent.cs | 2 +- Content.Shared/Shadowkin/EtherealComponent.cs | 5 ++- .../Shadowkin/ShadowkinComponent.cs | 14 +------ .../Shadowkin/ShadowkinCuffComponent.cs | 4 -- Resources/Prototypes/Actions/psionics.yml | 34 --------------- .../Entities/Mobs/Species/shadowkin.yml | 7 ++-- Resources/Prototypes/Psionics/psionics.yml | 2 +- Resources/Prototypes/Species/shadowkin.yml | 2 +- 13 files changed, 22 insertions(+), 133 deletions(-) delete mode 100644 Content.Server/Shadowkin/ShadowkinCuffSystem.cs delete mode 100644 Content.Shared/Shadowkin/ShadowkinCuffComponent.cs diff --git a/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs b/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs index fd394e0a228..8bdf67e7b02 100644 --- a/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs +++ b/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs @@ -34,6 +34,8 @@ private void OnPowerUsed(DarkSwapActionEvent args) if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap", args.ManaCost / 2, args.CheckInsulation)) { + SpawnAtPosition("ShadowkinShadow", Transform(args.Performer).Coordinates); + SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(args.Performer).Coordinates); RemComp(args.Performer, ethereal); args.Handled = true; } @@ -50,7 +52,7 @@ private void OnPowerUsed(DarkSwapActionEvent args) } if (args.Handled) - _psionics.LogPowerUsed(args.Performer, "DarkSwap", 0, 0); + _psionics.LogPowerUsed(args.Performer, "DarkSwap"); } } } diff --git a/Content.Server/Shadowkin/EtherealStunItemSystem.cs b/Content.Server/Shadowkin/EtherealStunItemSystem.cs index b48b4d4fecf..f7f735a0525 100644 --- a/Content.Server/Shadowkin/EtherealStunItemSystem.cs +++ b/Content.Server/Shadowkin/EtherealStunItemSystem.cs @@ -21,7 +21,8 @@ private void OnUseInHand(EntityUid uid, EtherealStunItemComponent component, Use { foreach (var ent in _lookup.GetEntitiesInRange(uid, component.Radius)) { - if (!TryComp(ent, out var ethereal)) + if (!TryComp(ent, out var ethereal) + || !ethereal.CanBeStunned) continue; RemComp(ent, ethereal); diff --git a/Content.Server/Shadowkin/EtherealSystem.cs b/Content.Server/Shadowkin/EtherealSystem.cs index 2622547a3f6..4ff0654dfb2 100644 --- a/Content.Server/Shadowkin/EtherealSystem.cs +++ b/Content.Server/Shadowkin/EtherealSystem.cs @@ -79,9 +79,6 @@ public override void OnShutdown(EntityUid uid, EtherealComponent component, Comp RemComp(uid); RemComp(uid); - SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates); - SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates); - foreach (var light in component.DarkenedLights.ToArray()) { if (!TryComp(light, out var pointLight) @@ -181,7 +178,7 @@ public override void Update(float frameTime) if (etherealLight.AttachedEntity == uid && _random.Prob(0.03f)) - etherealLight.AttachedEntity = EntityUid.Invalid; + etherealLight.AttachedEntity = EntityUid.Invalid; if (!etherealLight.OldRadiusEdited) { @@ -213,4 +210,4 @@ public override void Update(float frameTime) } } } -} \ No newline at end of file +} diff --git a/Content.Server/Shadowkin/ShadowkinCuffSystem.cs b/Content.Server/Shadowkin/ShadowkinCuffSystem.cs deleted file mode 100644 index ce2b2588174..00000000000 --- a/Content.Server/Shadowkin/ShadowkinCuffSystem.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Content.Shared.Inventory.Events; -using Content.Shared.Clothing.Components; -using Content.Shared.Shadowkin; - -namespace Content.Server.Shadowkin; - -public sealed class ShadowkinCuffSystem : EntitySystem -{ - public override void Initialize() - { - base.Initialize(); - SubscribeLocalEvent(OnEquipped); - SubscribeLocalEvent(OnUnequipped); - } - - private void OnEquipped(EntityUid uid, ShadowkinCuffComponent component, GotEquippedEvent args) - { - if (!TryComp(uid, out var clothing) - || !clothing.Slots.HasFlag(args.SlotFlags)) - return; - - EnsureComp(args.Equipee); - } - - private void OnUnequipped(EntityUid uid, ShadowkinCuffComponent component, GotUnequippedEvent args) - { - RemComp(args.Equipee); - } -} \ No newline at end of file diff --git a/Content.Server/Shadowkin/ShadowkinSystem.cs b/Content.Server/Shadowkin/ShadowkinSystem.cs index 83461e7a7fe..21c6b078a59 100644 --- a/Content.Server/Shadowkin/ShadowkinSystem.cs +++ b/Content.Server/Shadowkin/ShadowkinSystem.cs @@ -30,7 +30,6 @@ public override void Initialize() SubscribeLocalEvent(OnInit); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnMindbreak); - SubscribeLocalEvent(OnAttemptPowerUse); SubscribeLocalEvent(OnManaUpdate); SubscribeLocalEvent(OnRejuvenate); SubscribeLocalEvent(OnEyeColorChange); @@ -38,18 +37,12 @@ public override void Initialize() private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentStartup args) { - if (component.BlackeyeSpawn) - ApplyBlackEye(uid); - _actionsSystem.AddAction(uid, ref component.ShadowkinSleepAction, ShadowkinSleepActionId, uid); - - UpdateShadowkinAlert(uid, component); } private void OnEyeColorChange(EntityUid uid, ShadowkinComponent component, EyeColorInitEvent args) { if (!TryComp(uid, out var humanoid) - || !component.BlackeyeSpawn || humanoid.EyeColor == component.OldEyeColor) return; @@ -95,12 +88,6 @@ public void UpdateShadowkinAlert(EntityUid uid, ShadowkinComponent component) _alerts.ClearAlert(uid, AlertType.ShadowkinPower); } - private void OnAttemptPowerUse(EntityUid uid, ShadowkinComponent component, OnAttemptPowerUseEvent args) - { - if (HasComp(uid)) - args.Cancel(); - } - private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnManaUpdateEvent args) { if (!TryComp(uid, out var magic)) @@ -112,26 +99,10 @@ private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnMan else magic.ManaGainMultiplier = 1; - if (magic.Mana <= component.BlackEyeMana) - ApplyBlackEye(uid); - Dirty(magic); // Update Shadowkin Overlay. UpdateShadowkinAlert(uid, component); } - /// - /// Blackeye the Shadowkin, its just a function to mindbreak the shadowkin but making sure "Removable" is checked true during it. - /// - /// - public void ApplyBlackEye(EntityUid uid) - { - if (!TryComp(uid, out var magic)) - return; - - magic.Removable = true; - _psionicAbilitiesSystem.MindBreak(uid); - } - private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMindbreakEvent args) { if (TryComp(uid, out var mindbreak)) @@ -144,17 +115,13 @@ private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMind Dirty(humanoid); } - if (component.BlackeyeSpawn) - return; - if (TryComp(uid, out var stamina)) _stamina.TakeStaminaDamage(uid, stamina.CritThreshold, stamina, uid); } private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, RejuvenateEvent args) { - if (component.BlackeyeSpawn - || !HasComp(uid)) + if (!HasComp(uid)) return; RemComp(uid); @@ -166,12 +133,11 @@ private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, Rejuvenat } EnsureComp(uid, out var magic); - magic.Mana = 250; - magic.MaxMana = 250; + magic.Mana = 200; + magic.MaxMana = 200; magic.ManaGain = 0.25f; - magic.BypassManaCheck = true; - magic.Removable = false; magic.MindbreakingFeedback = "shadowkin-blackeye"; + magic.NoMana = "shadowkin-tired"; if (_prototypeManager.TryIndex("ShadowkinPowers", out var shadowkinPowers)) _psionicAbilitiesSystem.InitializePsionicPower(uid, shadowkinPowers); diff --git a/Content.Shared/Psionics/PsionicComponent.cs b/Content.Shared/Psionics/PsionicComponent.cs index 16e0f028de0..24a2efe0cfe 100644 --- a/Content.Shared/Psionics/PsionicComponent.cs +++ b/Content.Shared/Psionics/PsionicComponent.cs @@ -12,7 +12,7 @@ public sealed partial class PsionicComponent : Component /// Current Mana. /// [DataField, AutoNetworkedField] - public float Mana; + public float Mana = 50; /// /// Max Mana Possible. diff --git a/Content.Shared/Shadowkin/EtherealComponent.cs b/Content.Shared/Shadowkin/EtherealComponent.cs index 0fc50c0f12e..6dc6a9d41af 100644 --- a/Content.Shared/Shadowkin/EtherealComponent.cs +++ b/Content.Shared/Shadowkin/EtherealComponent.cs @@ -23,6 +23,9 @@ public sealed partial class EtherealComponent : Component [DataField] public float DarkenRate = 0.084f; + [DataField] + public bool CanBeStunned = true; + public List DarkenedLights = new(); public float DarkenAccumulator; @@ -33,4 +36,4 @@ public sealed partial class EtherealComponent : Component public List SuppressedFactions = new(); public bool HasDoorBumpTag; -} \ No newline at end of file +} diff --git a/Content.Shared/Shadowkin/ShadowkinComponent.cs b/Content.Shared/Shadowkin/ShadowkinComponent.cs index b382f3112b7..9186b0d5c8e 100644 --- a/Content.Shared/Shadowkin/ShadowkinComponent.cs +++ b/Content.Shared/Shadowkin/ShadowkinComponent.cs @@ -17,18 +17,6 @@ public sealed partial class ShadowkinComponent : Component [DataField] public float SleepManaRegenMultiplier = 4; - /// - /// On MapInitEvent, will Blackeye the Shadowkin. - /// - [DataField] - public bool BlackeyeSpawn; - - /// - /// If mana is equal or lower then this value, blackeye the shadowkin. - /// - [DataField] - public float BlackEyeMana; - /// /// Set the Black-Eye Color. /// @@ -39,4 +27,4 @@ public sealed partial class ShadowkinComponent : Component [DataField] public EntityUid? ShadowkinSleepAction; -} \ No newline at end of file +} diff --git a/Content.Shared/Shadowkin/ShadowkinCuffComponent.cs b/Content.Shared/Shadowkin/ShadowkinCuffComponent.cs deleted file mode 100644 index b4c62d66647..00000000000 --- a/Content.Shared/Shadowkin/ShadowkinCuffComponent.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Content.Shared.Shadowkin; - -[RegisterComponent] -public sealed partial class ShadowkinCuffComponent : Component { } \ No newline at end of file diff --git a/Resources/Prototypes/Actions/psionics.yml b/Resources/Prototypes/Actions/psionics.yml index a372a480ac7..198eacac994 100644 --- a/Resources/Prototypes/Actions/psionics.yml +++ b/Resources/Prototypes/Actions/psionics.yml @@ -291,40 +291,6 @@ maxThrowStrength: 5 spaceRange: 3 -- type: entity - id: ActionShadowkinShadeskip - name: action-name-shadeskip - description: action-description-shadowkin-shadeskip - noSpawn: true - components: - - type: InstantAction - icon: { sprite: Interface/Actions/shadowkin_icons.rsi, state: shadeskip } - useDelay: 10 - checkCanInteract: false - event: !type:AnomalyPowerActionEvent - settings: - powerName: "Shadowkin-Shadeskip" - manaCost: 25 - checkInsulation: false - minGlimmer: 0 - maxGlimmer: 0 - doSupercritical: false - entitySpawnEntries: - - settings: - spawnOnPulse: true - minAmount: 5 - maxAmount: 10 - maxRange: 2.5 - spawns: - - ShadowkinShadow - - settings: - spawnOnPulse: true - minAmount: 1 - maxAmount: 1 - maxRange: 0.5 - spawns: - - EffectFlashShadowkinShadeskip - - type: entity id: ActionDarkSwap name: action-name-darkswap diff --git a/Resources/Prototypes/Entities/Mobs/Species/shadowkin.yml b/Resources/Prototypes/Entities/Mobs/Species/shadowkin.yml index 393cb0b8716..740e64b983b 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/shadowkin.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/shadowkin.yml @@ -224,10 +224,9 @@ - type: Psionic mindbreakingFeedback: shadowkin-blackeye manaGain: 0.25 - mana: 150 - maxMana: 250 - bypassManaCheck: true - removable: false + mana: 100 + maxMana: 200 + noMana: shadowkin-tired - type: InnatePsionicPowers powersToAdd: - ShadowkinPowers diff --git a/Resources/Prototypes/Psionics/psionics.yml b/Resources/Prototypes/Psionics/psionics.yml index 7ee6e193e37..23418a33733 100644 --- a/Resources/Prototypes/Psionics/psionics.yml +++ b/Resources/Prototypes/Psionics/psionics.yml @@ -224,7 +224,7 @@ name: Shadowkin Powers description: shadowkin-powers-description actions: - - ActionShadowkinShadeskip + - ActionShadeskip - ActionDarkSwap powerSlotCost: 1 diff --git a/Resources/Prototypes/Species/shadowkin.yml b/Resources/Prototypes/Species/shadowkin.yml index f7674e80d61..7cbd752092f 100644 --- a/Resources/Prototypes/Species/shadowkin.yml +++ b/Resources/Prototypes/Species/shadowkin.yml @@ -1,7 +1,7 @@ - type: species id: Shadowkin name: species-name-shadowkin - roundStart: false + roundStart: true prototype: MobShadowkin sprites: MobShadowkinSprites defaultSkinTone: "#FFFFFF" From 4f25931eeb1678b9cf8b3f25583be679494217b0 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sat, 9 Nov 2024 19:44:14 +0100 Subject: [PATCH 02/13] Alert/Mana --- Content.Server/Psionics/PsionicsSystem.cs | 6 ++++ Content.Server/Shadowkin/ShadowkinSystem.cs | 19 ----------- Content.Shared/Alert/AlertType.cs | 2 +- .../Psionics/SharedPsionicAbilitiesSystem.cs | 14 ++++++++ Resources/Locale/en-US/alerts/alerts.ftl | 3 ++ Resources/Locale/en-US/alerts/shadowkin.ftl | 2 -- Resources/Prototypes/Alerts/alerts.yml | 26 ++++++++++++++- Resources/Prototypes/Alerts/shadowkin.yml | 23 ------------- .../Entities/Clothing/OuterClothing/misc.yml | 31 +++++++++--------- .../meta.json | 0 .../power0.png | Bin .../power1.png | Bin .../power2.png | Bin .../power3.png | Bin .../power4.png | Bin .../power5.png | Bin .../power6.png | Bin .../power7.png | Bin 18 files changed, 64 insertions(+), 62 deletions(-) delete mode 100644 Resources/Locale/en-US/alerts/shadowkin.ftl delete mode 100644 Resources/Prototypes/Alerts/shadowkin.yml rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/meta.json (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power0.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power1.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power2.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power3.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power4.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power5.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power6.png (100%) rename Resources/Textures/Interface/Alerts/{shadowkin_power.rsi => mana.rsi}/power7.png (100%) diff --git a/Content.Server/Psionics/PsionicsSystem.cs b/Content.Server/Psionics/PsionicsSystem.cs index 9685334daba..b0155caad31 100644 --- a/Content.Server/Psionics/PsionicsSystem.cs +++ b/Content.Server/Psionics/PsionicsSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Mobs; using Content.Shared.Damage; using Content.Shared.Interaction.Events; +using Content.Shared.Alert; namespace Content.Server.Psionics; @@ -39,6 +40,7 @@ public sealed class PsionicsSystem : EntitySystem [Dependency] private readonly IPrototypeManager _protoMan = default!; [Dependency] private readonly PsionicFamiliarSystem _psionicFamiliar = default!; [Dependency] private readonly NPCRetaliationSystem _retaliationSystem = default!; + [Dependency] private readonly AlertsSystem _alerts = default!; private const string BaselineAmplification = "Baseline Amplification"; private const string BaselineDampening = "Baseline Dampening"; @@ -135,6 +137,8 @@ private void CheckAntiPsionic(EntityUid entity, AntiPsionicWeaponComponent compo private void OnInit(EntityUid uid, PsionicComponent component, ComponentStartup args) { + _alerts.ShowAlert(uid, AlertType.Mana, 0); + component.AmplificationSources.Add(BaselineAmplification, _random.NextFloat(component.BaselineAmplification.Item1, component.BaselineAmplification.Item2)); component.DampeningSources.Add(BaselineDampening, _random.NextFloat(component.BaselineDampening.Item1, component.BaselineDampening.Item2)); @@ -148,6 +152,8 @@ private void OnInit(EntityUid uid, PsionicComponent component, ComponentStartup private void OnRemove(EntityUid uid, PsionicComponent component, ComponentRemove args) { + _alerts.ClearAlert(uid, AlertType.Mana); + if (!HasComp(uid)) return; diff --git a/Content.Server/Shadowkin/ShadowkinSystem.cs b/Content.Server/Shadowkin/ShadowkinSystem.cs index 21c6b078a59..4d74152f221 100644 --- a/Content.Server/Shadowkin/ShadowkinSystem.cs +++ b/Content.Server/Shadowkin/ShadowkinSystem.cs @@ -74,20 +74,6 @@ private void OnExamined(EntityUid uid, ShadowkinComponent component, ExaminedEve )); } - /// - /// Update the Shadowkin Alert, if Blackeye will remove the Alert, if not will update to its current power status. - /// - public void UpdateShadowkinAlert(EntityUid uid, ShadowkinComponent component) - { - if (TryComp(uid, out var magic)) - { - var severity = (short) ContentHelpers.RoundToLevels(magic.Mana, magic.MaxMana, 8); - _alerts.ShowAlert(uid, AlertType.ShadowkinPower, severity); - } - else - _alerts.ClearAlert(uid, AlertType.ShadowkinPower); - } - private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnManaUpdateEvent args) { if (!TryComp(uid, out var magic)) @@ -98,9 +84,6 @@ private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnMan magic.ManaGainMultiplier = component.SleepManaRegenMultiplier; else magic.ManaGainMultiplier = 1; - - Dirty(magic); // Update Shadowkin Overlay. - UpdateShadowkinAlert(uid, component); } private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMindbreakEvent args) @@ -141,7 +124,5 @@ private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, Rejuvenat if (_prototypeManager.TryIndex("ShadowkinPowers", out var shadowkinPowers)) _psionicAbilitiesSystem.InitializePsionicPower(uid, shadowkinPowers); - - UpdateShadowkinAlert(uid, component); } } diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index bd8c1dbe257..5bc72fa3d91 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -71,7 +71,7 @@ public enum AlertType : byte BorgCrit, BorgDead, Offer, - ShadowkinPower, + Mana, Deflecting, } diff --git a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs index b79dabbc416..617809d51c6 100644 --- a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs +++ b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs @@ -8,6 +8,8 @@ using Content.Shared.Mobs.Systems; using Content.Shared.FixedPoint; using Content.Shared.Rejuvenate; +using Content.Shared.Alert; +using Content.Shared.Rounding; namespace Content.Shared.Abilities.Psionics { @@ -20,6 +22,7 @@ public sealed class SharedPsionicAbilitiesSystem : EntitySystem [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly ContestsSystem _contests = default!; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly AlertsSystem _alerts = default!; public override void Initialize() { @@ -133,6 +136,15 @@ public float ModifiedDampening(EntityUid uid, PsionicComponent component) return component.CurrentDampening / _contests.MoodContest(uid, true); } + /// + /// Update the Mana Alert, will update to its current mana status. + /// + public void UpdateManaAlert(EntityUid uid, PsionicComponent component) + { + var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); + _alerts.ShowAlert(uid, AlertType.Mana, severity); + } + public void OnRejuvenate(EntityUid uid, PsionicComponent component, RejuvenateEvent args) { component.Mana = component.MaxMana; @@ -166,6 +178,8 @@ public override void Update(float frameTime) component.Mana += gainedmana; FixedPoint2.Min(component.Mana, component.MaxMana); + UpdateManaAlert(uid, component); + var ev = new OnManaUpdateEvent(); RaiseLocalEvent(uid, ref ev); } diff --git a/Resources/Locale/en-US/alerts/alerts.ftl b/Resources/Locale/en-US/alerts/alerts.ftl index ad61ae89674..449a33470db 100644 --- a/Resources/Locale/en-US/alerts/alerts.ftl +++ b/Resources/Locale/en-US/alerts/alerts.ftl @@ -116,3 +116,6 @@ alerts-offer-desc = Someone offers you an item. alerts-deflecting-name = Deflecting alerts-deflecting-desc = You have a chance to deflect incoming projectiles. Standing still or moving slowly will increase this chance. + +alerts-mana-name = Mana Level +alerts-mana-desc = How much mana is available to spend on your powers. diff --git a/Resources/Locale/en-US/alerts/shadowkin.ftl b/Resources/Locale/en-US/alerts/shadowkin.ftl deleted file mode 100644 index 10f8438b76c..00000000000 --- a/Resources/Locale/en-US/alerts/shadowkin.ftl +++ /dev/null @@ -1,2 +0,0 @@ -alerts-shadowkin-power-name = Power Level -alerts-shadowkin-power-desc = How much energy is available to spend on Shadowkin powers. \ No newline at end of file diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index dffebf4b1dd..09b76c3071d 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -7,7 +7,7 @@ - category: Health - category: Mood - category: Stamina - - alertType: ShadowkinPower + - alertType: Mana - alertType: SuitPower - category: Internals - alertType: Fire @@ -619,3 +619,27 @@ state: deflecting0 name: alerts-deflecting-name description: alerts-deflecting-desc + +- type: alert + id: Mana + icons: + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power0 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power1 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power2 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power3 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power4 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power5 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power6 + - sprite: /Textures/Interface/Alerts/mana.rsi + state: power7 + name: alerts-mana-name + description: alerts-mana-desc + minSeverity: 0 + maxSeverity: 7 diff --git a/Resources/Prototypes/Alerts/shadowkin.yml b/Resources/Prototypes/Alerts/shadowkin.yml deleted file mode 100644 index 66d41351bab..00000000000 --- a/Resources/Prototypes/Alerts/shadowkin.yml +++ /dev/null @@ -1,23 +0,0 @@ -- type: alert - id: ShadowkinPower - icons: - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power0 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power1 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power2 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power3 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power4 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power5 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power6 - - sprite: /Textures/Interface/Alerts/shadowkin_power.rsi - state: power7 - name: alerts-shadowkin-power-name - description: alerts-shadowkin-power-desc - minSeverity: 0 - maxSeverity: 7 \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml index b5169a9cf6b..ed764485727 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/misc.yml @@ -429,19 +429,18 @@ - type: Clothing sprite: Clothing/OuterClothing/Misc/unathirobe.rsi -- type: entity - parent: ClothingOuterBase - id: ClothingOuterShadowkinRestraints - name: shadowkin restraints - description: One of the first creations after finding Shadowkin, these were used to contain the Shadowkin during research so they didn't teleport away. - components: - - type: Sprite - sprite: Clothing/OuterClothing/Misc/shadowkinrestraints.rsi - - type: Clothing - sprite: Clothing/OuterClothing/Misc/shadowkinrestraints.rsi - equipDelay: 0.5 - unequipDelay: 10 - - type: ShadowkinCuff - - type: GuideHelp - guides: - - Shadowkin \ No newline at end of file +# - type: entity # TODO: There no use for it now... but pehaps we could turn it into a Anti-Psionic Clothing like headcage? +# parent: ClothingOuterBase +# id: ClothingOuterShadowkinRestraints +# name: shadowkin restraints +# description: One of the first creations after finding Shadowkin, these were used to contain the Shadowkin during research so they didn't teleport away. +# components: +# - type: Sprite +# sprite: Clothing/OuterClothing/Misc/shadowkinrestraints.rsi +# - type: Clothing +# sprite: Clothing/OuterClothing/Misc/shadowkinrestraints.rsi +# equipDelay: 0.5 +# unequipDelay: 10 +# - type: GuideHelp +# guides: +# - Shadowkin diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/meta.json b/Resources/Textures/Interface/Alerts/mana.rsi/meta.json similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/meta.json rename to Resources/Textures/Interface/Alerts/mana.rsi/meta.json diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power0.png b/Resources/Textures/Interface/Alerts/mana.rsi/power0.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power0.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power0.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power1.png b/Resources/Textures/Interface/Alerts/mana.rsi/power1.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power1.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power1.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power2.png b/Resources/Textures/Interface/Alerts/mana.rsi/power2.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power2.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power2.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power3.png b/Resources/Textures/Interface/Alerts/mana.rsi/power3.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power3.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power3.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power4.png b/Resources/Textures/Interface/Alerts/mana.rsi/power4.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power4.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power4.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power5.png b/Resources/Textures/Interface/Alerts/mana.rsi/power5.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power5.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power5.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power6.png b/Resources/Textures/Interface/Alerts/mana.rsi/power6.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power6.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power6.png diff --git a/Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power7.png b/Resources/Textures/Interface/Alerts/mana.rsi/power7.png similarity index 100% rename from Resources/Textures/Interface/Alerts/shadowkin_power.rsi/power7.png rename to Resources/Textures/Interface/Alerts/mana.rsi/power7.png From fe195405be553ebba2f251acd04d044dd28da268 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sat, 9 Nov 2024 20:10:19 +0100 Subject: [PATCH 03/13] Apply Alert Changes --- Content.Server/Alert/Click/CheckMana.cs | 38 +++++++++++++++++++ Content.Shared/Psionics/PsionicComponent.cs | 1 + .../Psionics/SharedPsionicAbilitiesSystem.cs | 12 +----- Resources/Locale/en-US/alerts/alerts.ftl | 1 + Resources/Locale/en-US/species/shadowkin.ftl | 3 +- Resources/Prototypes/Alerts/alerts.yml | 1 + 6 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 Content.Server/Alert/Click/CheckMana.cs diff --git a/Content.Server/Alert/Click/CheckMana.cs b/Content.Server/Alert/Click/CheckMana.cs new file mode 100644 index 00000000000..40661af5549 --- /dev/null +++ b/Content.Server/Alert/Click/CheckMana.cs @@ -0,0 +1,38 @@ +using Content.Server.Chat.Managers; +using Content.Shared.Abilities.Psionics; +using Content.Shared.Alert; +using Content.Shared.Chat; +using JetBrains.Annotations; +using Robust.Server.Player; +using Robust.Shared.Player; + +namespace Content.Server.Alert.Click; + +[UsedImplicitly] +[DataDefinition] +public sealed partial class CheckMana : IAlertClick +{ + public void AlertClicked(EntityUid player) + { + var chatManager = IoCManager.Resolve(); + var entityManager = IoCManager.Resolve(); + var playerManager = IoCManager.Resolve(); + + if (!entityManager.TryGetComponent(player, out PsionicComponent? magic) || + !playerManager.TryGetSessionByEntity(player, out var session)) + return; + + var baseMsg = Loc.GetString("mana-alert", ("mana", magic.Mana), ("manaMax", magic.MaxMana)); + SendMessage(chatManager, baseMsg, session); + } + + private static void SendMessage(IChatManager chatManager, string msg, ICommonSession session) + { + chatManager.ChatMessageToOne(ChatChannel.Emotes, + msg, + msg, + EntityUid.Invalid, + false, + session.Channel); + } +} diff --git a/Content.Shared/Psionics/PsionicComponent.cs b/Content.Shared/Psionics/PsionicComponent.cs index 24a2efe0cfe..31211ca4233 100644 --- a/Content.Shared/Psionics/PsionicComponent.cs +++ b/Content.Shared/Psionics/PsionicComponent.cs @@ -212,6 +212,7 @@ private set public string AlreadyCasting = "already-casting"; /// Popup to play if there no Mana left for a power to execute. + [DataField] public string NoMana = "no-mana"; /// diff --git a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs index 617809d51c6..9565080adf7 100644 --- a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs +++ b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs @@ -136,15 +136,6 @@ public float ModifiedDampening(EntityUid uid, PsionicComponent component) return component.CurrentDampening / _contests.MoodContest(uid, true); } - /// - /// Update the Mana Alert, will update to its current mana status. - /// - public void UpdateManaAlert(EntityUid uid, PsionicComponent component) - { - var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); - _alerts.ShowAlert(uid, AlertType.Mana, severity); - } - public void OnRejuvenate(EntityUid uid, PsionicComponent component, RejuvenateEvent args) { component.Mana = component.MaxMana; @@ -178,7 +169,8 @@ public override void Update(float frameTime) component.Mana += gainedmana; FixedPoint2.Min(component.Mana, component.MaxMana); - UpdateManaAlert(uid, component); + var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); + _alerts.ShowAlert(uid, AlertType.Mana, severity); var ev = new OnManaUpdateEvent(); RaiseLocalEvent(uid, ref ev); diff --git a/Resources/Locale/en-US/alerts/alerts.ftl b/Resources/Locale/en-US/alerts/alerts.ftl index 449a33470db..c84c097345f 100644 --- a/Resources/Locale/en-US/alerts/alerts.ftl +++ b/Resources/Locale/en-US/alerts/alerts.ftl @@ -119,3 +119,4 @@ alerts-deflecting-desc = You have a chance to deflect incoming projectiles. Stan alerts-mana-name = Mana Level alerts-mana-desc = How much mana is available to spend on your powers. +mana-alert = [font size=12][color=green]Mana:{$mana}/{$manaMax}[/color][/font] diff --git a/Resources/Locale/en-US/species/shadowkin.ftl b/Resources/Locale/en-US/species/shadowkin.ftl index ebc56487b7a..b0c282df752 100644 --- a/Resources/Locale/en-US/species/shadowkin.ftl +++ b/Resources/Locale/en-US/species/shadowkin.ftl @@ -12,4 +12,5 @@ examine-mindbroken-shadowkin-message = {CAPITALIZE($entity)} seems to be a black identity-eye-shadowkin = {$color}-eye -shadowkin-blackeye = I feel my power draining away... \ No newline at end of file +shadowkin-blackeye = I feel my power draining away... +shadowkin-tired = Im too tired! diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 09b76c3071d..449f40a2123 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -622,6 +622,7 @@ - type: alert id: Mana + onClick: !type:CheckMana { } icons: - sprite: /Textures/Interface/Alerts/mana.rsi state: power0 From ed7ce5b20bf47b517cf0ba7606109448fa545502 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sat, 9 Nov 2024 20:15:16 +0100 Subject: [PATCH 04/13] better --- Resources/Locale/en-US/alerts/alerts.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Locale/en-US/alerts/alerts.ftl b/Resources/Locale/en-US/alerts/alerts.ftl index c84c097345f..b9d3b6269dc 100644 --- a/Resources/Locale/en-US/alerts/alerts.ftl +++ b/Resources/Locale/en-US/alerts/alerts.ftl @@ -119,4 +119,4 @@ alerts-deflecting-desc = You have a chance to deflect incoming projectiles. Stan alerts-mana-name = Mana Level alerts-mana-desc = How much mana is available to spend on your powers. -mana-alert = [font size=12][color=green]Mana:{$mana}/{$manaMax}[/color][/font] +mana-alert = [font size=12][color=purple]Mana: {$mana}/{$manaMax}[/color][/font] From 47283ce28c5684f1781d5fe88e83a9c177da6720 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Tue, 12 Nov 2024 19:40:18 +0100 Subject: [PATCH 05/13] DarkSwap Rework --- .../Psionics/Abilities/DarkSwapSystem.cs | 4 +-- .../Psionics/SharedPsionicAbilitiesSystem.cs | 3 ++ Content.Shared/Shadowkin/EtherealComponent.cs | 2 ++ .../Shadowkin/SharedEtherealSystem.cs | 33 +++++++++++++++++-- .../Locale/en-US/psionics/psionic-powers.ftl | 6 ++-- Resources/Prototypes/Actions/psionics.yml | 3 +- Resources/Prototypes/Psionics/psionics.yml | 4 +-- 7 files changed, 43 insertions(+), 12 deletions(-) diff --git a/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs b/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs index 8bdf67e7b02..a3ea3f5c824 100644 --- a/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs +++ b/Content.Server/Abilities/Psionics/Abilities/DarkSwapSystem.cs @@ -32,7 +32,7 @@ private void OnPowerUsed(DarkSwapActionEvent args) return; } - if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap", args.ManaCost / 2, args.CheckInsulation)) + if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap")) { SpawnAtPosition("ShadowkinShadow", Transform(args.Performer).Coordinates); SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(args.Performer).Coordinates); @@ -40,7 +40,7 @@ private void OnPowerUsed(DarkSwapActionEvent args) args.Handled = true; } } - else if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap", args.ManaCost, args.CheckInsulation)) + else if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap", args.ManaCost)) { var newethereal = EnsureComp(args.Performer); newethereal.Darken = true; diff --git a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs index 9565080adf7..723cebb4f97 100644 --- a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs +++ b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs @@ -163,6 +163,9 @@ public override void Update(float frameTime) if (component.Mana > component.MaxMana) component.Mana = component.MaxMana; + if (component.Mana < 0) + component.Mana = 0; + if (component.Mana < component.MaxMana) { var gainedmana = component.ManaGain * component.ManaGainMultiplier; diff --git a/Content.Shared/Shadowkin/EtherealComponent.cs b/Content.Shared/Shadowkin/EtherealComponent.cs index 6dc6a9d41af..1439a90d046 100644 --- a/Content.Shared/Shadowkin/EtherealComponent.cs +++ b/Content.Shared/Shadowkin/EtherealComponent.cs @@ -28,6 +28,8 @@ public sealed partial class EtherealComponent : Component public List DarkenedLights = new(); + public float OldManaGain; + public float DarkenAccumulator; public int OldMobMask; diff --git a/Content.Shared/Shadowkin/SharedEtherealSystem.cs b/Content.Shared/Shadowkin/SharedEtherealSystem.cs index 66196faf0a3..e1e96b44fc3 100644 --- a/Content.Shared/Shadowkin/SharedEtherealSystem.cs +++ b/Content.Shared/Shadowkin/SharedEtherealSystem.cs @@ -38,10 +38,17 @@ public override void Initialize() SubscribeLocalEvent(OnShootAttempt); SubscribeLocalEvent(OnMindbreak); SubscribeLocalEvent(OnMobStateChanged); + SubscribeLocalEvent(OnManaUpdate); } public virtual void OnStartup(EntityUid uid, EtherealComponent component, MapInitEvent args) { + if (TryComp(uid, out var magic)) + { + component.OldManaGain = magic.ManaGain; + magic.ManaGain = -1; + } + if (!TryComp(uid, out var fixtures)) return; @@ -67,6 +74,12 @@ public virtual void OnStartup(EntityUid uid, EtherealComponent component, MapIni public virtual void OnShutdown(EntityUid uid, EtherealComponent component, ComponentShutdown args) { + if (TryComp(uid, out var magic)) + magic.ManaGain = component.OldManaGain; + + if (component.HasDoorBumpTag) + _tag.AddTag(uid, "DoorBumpOpener"); + if (!TryComp(uid, out var fixtures)) return; @@ -74,13 +87,25 @@ public virtual void OnShutdown(EntityUid uid, EtherealComponent component, Compo _physics.SetCollisionMask(uid, fixture.Key, fixture.Value, component.OldMobMask, fixtures); _physics.SetCollisionLayer(uid, fixture.Key, fixture.Value, component.OldMobLayer, fixtures); + } - if (component.HasDoorBumpTag) - _tag.AddTag(uid, "DoorBumpOpener"); + private void OnManaUpdate(EntityUid uid, EtherealComponent component, ref OnManaUpdateEvent args) + { + if (!TryComp(uid, out var magic)) + return; + + if (magic.Mana <= 0) + { + SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates); + SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates); + RemComp(uid, component); + } } private void OnMindbreak(EntityUid uid, EtherealComponent component, ref OnMindbreakEvent args) { + SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates); + SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates); RemComp(uid, component); } @@ -88,7 +113,11 @@ private void OnMobStateChanged(EntityUid uid, EtherealComponent component, MobSt { if (args.NewMobState == MobState.Critical || args.NewMobState == MobState.Dead) + { + SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates); + SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates); RemComp(uid, component); + } } private void OnShootAttempt(Entity ent, ref ShotAttemptedEvent args) diff --git a/Resources/Locale/en-US/psionics/psionic-powers.ftl b/Resources/Locale/en-US/psionics/psionic-powers.ftl index a7cec77aa2a..86421203c66 100644 --- a/Resources/Locale/en-US/psionics/psionic-powers.ftl +++ b/Resources/Locale/en-US/psionics/psionic-powers.ftl @@ -167,13 +167,11 @@ psionic-roll-failed = For a moment, my consciousness expands, yet I feel that it entity-anomaly-no-grid = There is nowhere for me to conjure beings. power-overwhelming-power-feedback = {CAPITALIZE($entity)} wields a vast connection to the noösphere -# Shadowkin ShadeSkip -action-description-shadowkin-shadeskip = Aaramrra! - # DarkSwap action-name-darkswap = DarkSwap action-description-darkswap = Mmra Mamm! - +darkswap-power-initialization-feedback = + For a short moment, i find myself able to break the realms... phasing in the shadows and the dark, like shadowkins... ready to traval to the darknest of places... ethereal-pickup-fail = My hand sizzles as it passes through... # Psionic Familiar System diff --git a/Resources/Prototypes/Actions/psionics.yml b/Resources/Prototypes/Actions/psionics.yml index 198eacac994..4e2e8030384 100644 --- a/Resources/Prototypes/Actions/psionics.yml +++ b/Resources/Prototypes/Actions/psionics.yml @@ -302,8 +302,7 @@ useDelay: 10 checkCanInteract: false event: !type:DarkSwapActionEvent - manaCost: 100 - checkInsulation: false + manaCost: 30 - type: entity id: ActionPyrokineticFlare diff --git a/Resources/Prototypes/Psionics/psionics.yml b/Resources/Prototypes/Psionics/psionics.yml index 23418a33733..9b526665851 100644 --- a/Resources/Prototypes/Psionics/psionics.yml +++ b/Resources/Prototypes/Psionics/psionics.yml @@ -224,9 +224,8 @@ name: Shadowkin Powers description: shadowkin-powers-description actions: - - ActionShadeskip - ActionDarkSwap - powerSlotCost: 1 + powerSlotCost: 0 - type: psionicPower id: EtherealVisionPower @@ -243,6 +242,7 @@ actions: - ActionDarkSwap powerSlotCost: 1 + initializationFeedback: darkswap-power-initialization-feedback - type: psionicPower id: PyrokineticFlare From 569fd36ac99122f3ae87ceb15440f63fa4ee5fae Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Tue, 12 Nov 2024 20:11:58 +0100 Subject: [PATCH 06/13] Finishing Touches --- Content.Server/Psionics/PsionicsSystem.cs | 16 +++++++++++++++- Content.Server/Shadowkin/ShadowkinSystem.cs | 2 ++ .../Psionics/SharedPsionicAbilitiesSystem.cs | 9 ++------- Content.Shared/Shadowkin/EtherealComponent.cs | 9 +++++++++ Content.Shared/Shadowkin/SharedEtherealSystem.cs | 6 ++++-- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Content.Server/Psionics/PsionicsSystem.cs b/Content.Server/Psionics/PsionicsSystem.cs index b0155caad31..dde94253043 100644 --- a/Content.Server/Psionics/PsionicsSystem.cs +++ b/Content.Server/Psionics/PsionicsSystem.cs @@ -20,6 +20,8 @@ using Content.Shared.Damage; using Content.Shared.Interaction.Events; using Content.Shared.Alert; +using Content.Shared.Rounding; +using Content.Shared.Psionics; namespace Content.Server.Psionics; @@ -73,6 +75,7 @@ public override void Initialize() SubscribeLocalEvent(OnMobstateChanged); SubscribeLocalEvent(OnDamageChanged); SubscribeLocalEvent(OnAttackAttempt); + SubscribeLocalEvent(OnManaUpdate); SubscribeLocalEvent(OnInit); SubscribeLocalEvent(OnRemove); @@ -137,7 +140,7 @@ private void CheckAntiPsionic(EntityUid entity, AntiPsionicWeaponComponent compo private void OnInit(EntityUid uid, PsionicComponent component, ComponentStartup args) { - _alerts.ShowAlert(uid, AlertType.Mana, 0); + UpdateManaAlert(uid, component); component.AmplificationSources.Add(BaselineAmplification, _random.NextFloat(component.BaselineAmplification.Item1, component.BaselineAmplification.Item2)); component.DampeningSources.Add(BaselineDampening, _random.NextFloat(component.BaselineDampening.Item1, component.BaselineDampening.Item2)); @@ -160,6 +163,17 @@ private void OnRemove(EntityUid uid, PsionicComponent component, ComponentRemove _npcFactonSystem.RemoveFaction(uid, "PsionicInterloper"); } + public void UpdateManaAlert(EntityUid uid, PsionicComponent component) + { + var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); + _alerts.ShowAlert(uid, AlertType.Mana, severity); + } + + private void OnManaUpdate(EntityUid uid, PsionicComponent component, ref OnManaUpdateEvent args) + { + UpdateManaAlert(uid, component); + } + private void OnStamHit(EntityUid uid, AntiPsionicWeaponComponent component, TakeStaminaDamageEvent args) { if (!HasComp(args.Target)) diff --git a/Content.Server/Shadowkin/ShadowkinSystem.cs b/Content.Server/Shadowkin/ShadowkinSystem.cs index 4d74152f221..8b4efe0ef19 100644 --- a/Content.Server/Shadowkin/ShadowkinSystem.cs +++ b/Content.Server/Shadowkin/ShadowkinSystem.cs @@ -84,6 +84,8 @@ private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnMan magic.ManaGainMultiplier = component.SleepManaRegenMultiplier; else magic.ManaGainMultiplier = 1; + + Dirty(magic); // Update Shadowkin Overlay. } private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMindbreakEvent args) diff --git a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs index 723cebb4f97..33d8807f4b2 100644 --- a/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs +++ b/Content.Shared/Psionics/SharedPsionicAbilitiesSystem.cs @@ -8,8 +8,6 @@ using Content.Shared.Mobs.Systems; using Content.Shared.FixedPoint; using Content.Shared.Rejuvenate; -using Content.Shared.Alert; -using Content.Shared.Rounding; namespace Content.Shared.Abilities.Psionics { @@ -22,7 +20,6 @@ public sealed class SharedPsionicAbilitiesSystem : EntitySystem [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly ContestsSystem _contests = default!; [Dependency] private readonly MobStateSystem _mobState = default!; - [Dependency] private readonly AlertsSystem _alerts = default!; public override void Initialize() { @@ -150,7 +147,8 @@ public override void Update(float frameTime) var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var component)) { - if (_mobState.IsDead(uid)) + if (_mobState.IsDead(uid) + || HasComp(uid)) continue; component.ManaAccumulator += frameTime; @@ -172,9 +170,6 @@ public override void Update(float frameTime) component.Mana += gainedmana; FixedPoint2.Min(component.Mana, component.MaxMana); - var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); - _alerts.ShowAlert(uid, AlertType.Mana, severity); - var ev = new OnManaUpdateEvent(); RaiseLocalEvent(uid, ref ev); } diff --git a/Content.Shared/Shadowkin/EtherealComponent.cs b/Content.Shared/Shadowkin/EtherealComponent.cs index 1439a90d046..fdf5c743e4f 100644 --- a/Content.Shared/Shadowkin/EtherealComponent.cs +++ b/Content.Shared/Shadowkin/EtherealComponent.cs @@ -23,9 +23,18 @@ public sealed partial class EtherealComponent : Component [DataField] public float DarkenRate = 0.084f; + /// + /// Can be stunned by ethereal stun objects? + /// [DataField] public bool CanBeStunned = true; + /// + /// Drain Mana is ent is psionic? + /// + [DataField] + public bool DrainMana = true; + public List DarkenedLights = new(); public float OldManaGain; diff --git a/Content.Shared/Shadowkin/SharedEtherealSystem.cs b/Content.Shared/Shadowkin/SharedEtherealSystem.cs index e1e96b44fc3..949a987333c 100644 --- a/Content.Shared/Shadowkin/SharedEtherealSystem.cs +++ b/Content.Shared/Shadowkin/SharedEtherealSystem.cs @@ -43,7 +43,8 @@ public override void Initialize() public virtual void OnStartup(EntityUid uid, EtherealComponent component, MapInitEvent args) { - if (TryComp(uid, out var magic)) + if (TryComp(uid, out var magic) + && component.DrainMana) { component.OldManaGain = magic.ManaGain; magic.ManaGain = -1; @@ -74,7 +75,8 @@ public virtual void OnStartup(EntityUid uid, EtherealComponent component, MapIni public virtual void OnShutdown(EntityUid uid, EtherealComponent component, ComponentShutdown args) { - if (TryComp(uid, out var magic)) + if (TryComp(uid, out var magic) + && component.DrainMana) magic.ManaGain = component.OldManaGain; if (component.HasDoorBumpTag) From 83243c0ea55ddbdd680d53199d3c79ed86f6b792 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Tue, 12 Nov 2024 20:29:27 +0100 Subject: [PATCH 07/13] Powers --- .../Roles/Jobs/Epistemics/forensicmantis.yml | 5 ++- .../PsionicPowerPool.yml} | 1 + .../Roles/Jobs/Science/research_director.yml | 5 ++- Resources/Prototypes/Traits/mental.yml | 45 ++++++++++++++++--- Resources/Prototypes/Traits/skills.yml | 5 ++- 5 files changed, 51 insertions(+), 10 deletions(-) rename Resources/Prototypes/{Nyanotrasen/psionicPowers.yml => Psionics/PsionicPowerPool.yml} (95%) diff --git a/Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml b/Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml index 3834c3b95c4..6c8e1d77151 100644 --- a/Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml +++ b/Resources/Prototypes/Nyanotrasen/Roles/Jobs/Epistemics/forensicmantis.yml @@ -21,9 +21,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye startingGear: ForensicMantisGear icon: "JobIconForensicMantis" supervisors: job-supervisors-rd diff --git a/Resources/Prototypes/Nyanotrasen/psionicPowers.yml b/Resources/Prototypes/Psionics/PsionicPowerPool.yml similarity index 95% rename from Resources/Prototypes/Nyanotrasen/psionicPowers.yml rename to Resources/Prototypes/Psionics/PsionicPowerPool.yml index 8b2911018f9..a5cfccbbae5 100644 --- a/Resources/Prototypes/Nyanotrasen/psionicPowers.yml +++ b/Resources/Prototypes/Psionics/PsionicPowerPool.yml @@ -17,3 +17,4 @@ TelekineticPulsePower: 0.15 PyrokineticFlare: 0.3 SummonImpPower: 0.15 + DarkSwapPower: 0.1 diff --git a/Resources/Prototypes/Roles/Jobs/Science/research_director.yml b/Resources/Prototypes/Roles/Jobs/Science/research_director.yml index 4fc9325f39d..bf8a83c7e8d 100644 --- a/Resources/Prototypes/Roles/Jobs/Science/research_director.yml +++ b/Resources/Prototypes/Roles/Jobs/Science/research_director.yml @@ -22,9 +22,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye weight: 10 startingGear: ResearchDirectorGear icon: "JobIconResearchDirector" diff --git a/Resources/Prototypes/Traits/mental.yml b/Resources/Prototypes/Traits/mental.yml index 5b4fc56bf02..13843007ac1 100644 --- a/Resources/Prototypes/Traits/mental.yml +++ b/Resources/Prototypes/Traits/mental.yml @@ -23,11 +23,19 @@ - !type:CharacterTraitRequirement traits: - AnomalousPositronics + - !type:CharacterLogicOrRequirement + requirements: + - !type:CharacterSpeciesRequirement + species: + - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterSpeciesRequirement inverted: true species: - Oni - - Shadowkin - !type:CharacterTraitRequirement inverted: true traits: @@ -63,11 +71,19 @@ - !type:CharacterTraitRequirement traits: - AnomalousPositronics + - !type:CharacterLogicOrRequirement + requirements: + - !type:CharacterSpeciesRequirement + species: + - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterSpeciesRequirement inverted: true species: - Oni - - Shadowkin - !type:CharacterTraitRequirement inverted: true traits: @@ -106,9 +122,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterTraitRequirement inverted: true traits: @@ -147,9 +166,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterTraitRequirement inverted: true traits: @@ -188,9 +210,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterTraitRequirement inverted: true traits: @@ -229,9 +254,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterTraitRequirement inverted: true traits: @@ -269,9 +297,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - !type:CharacterTraitRequirement inverted: true traits: diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index 2306d254ed5..949b12a7aec 100644 --- a/Resources/Prototypes/Traits/skills.yml +++ b/Resources/Prototypes/Traits/skills.yml @@ -291,9 +291,12 @@ - !type:CharacterLogicOrRequirement requirements: - !type:CharacterSpeciesRequirement - inverted: true species: - Shadowkin + - !type:CharacterTraitRequirement + inverted: true + traits: + - ShadowkinBlackeye - type: trait id: TrapAvoider From 0a87907b80226459ec8bb281ef0e5fdecbfafc5b Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Tue, 12 Nov 2024 20:35:39 +0100 Subject: [PATCH 08/13] tiny fix --- Content.Shared/Shadowkin/SharedEtherealSystem.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Shadowkin/SharedEtherealSystem.cs b/Content.Shared/Shadowkin/SharedEtherealSystem.cs index 949a987333c..6fc30f31cc2 100644 --- a/Content.Shared/Shadowkin/SharedEtherealSystem.cs +++ b/Content.Shared/Shadowkin/SharedEtherealSystem.cs @@ -79,9 +79,6 @@ public virtual void OnShutdown(EntityUid uid, EtherealComponent component, Compo && component.DrainMana) magic.ManaGain = component.OldManaGain; - if (component.HasDoorBumpTag) - _tag.AddTag(uid, "DoorBumpOpener"); - if (!TryComp(uid, out var fixtures)) return; @@ -89,6 +86,10 @@ public virtual void OnShutdown(EntityUid uid, EtherealComponent component, Compo _physics.SetCollisionMask(uid, fixture.Key, fixture.Value, component.OldMobMask, fixtures); _physics.SetCollisionLayer(uid, fixture.Key, fixture.Value, component.OldMobLayer, fixtures); + + if (_cfg.GetCVar(CCVars.EtherealPassThrough)) + if (component.HasDoorBumpTag) + _tag.AddTag(uid, "DoorBumpOpener"); } private void OnManaUpdate(EntityUid uid, EtherealComponent component, ref OnManaUpdateEvent args) From b20fa81e7d1aa079a890b411a0e90921c44d87f5 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Tue, 12 Nov 2024 20:38:01 +0100 Subject: [PATCH 09/13] Stun on full mana drain. --- Content.Shared/Shadowkin/SharedEtherealSystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Content.Shared/Shadowkin/SharedEtherealSystem.cs b/Content.Shared/Shadowkin/SharedEtherealSystem.cs index 6fc30f31cc2..4d9a5e47b0d 100644 --- a/Content.Shared/Shadowkin/SharedEtherealSystem.cs +++ b/Content.Shared/Shadowkin/SharedEtherealSystem.cs @@ -14,6 +14,8 @@ using Robust.Shared.Configuration; using Content.Shared.Abilities.Psionics; using Content.Shared.Tag; +using Content.Shared.Damage.Components; +using Content.Shared.Damage.Systems; namespace Content.Shared.Shadowkin; @@ -24,6 +26,7 @@ public abstract class SharedEtherealSystem : EntitySystem [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly TagSystem _tag = default!; + [Dependency] private readonly StaminaSystem _stamina = default!; public override void Initialize() { @@ -99,6 +102,9 @@ private void OnManaUpdate(EntityUid uid, EtherealComponent component, ref OnMana if (magic.Mana <= 0) { + if (TryComp(uid, out var stamina)) + _stamina.TakeStaminaDamage(uid, stamina.CritThreshold, stamina, uid); + SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates); SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates); RemComp(uid, component); From 47d32afaeb57a1ffc6de59f7e087146ec2b698ab Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Thu, 14 Nov 2024 19:43:20 +0100 Subject: [PATCH 10/13] linter is happy --- .../Prototypes/Entities/Structures/Machines/lathe.yml | 1 - Resources/Prototypes/Recipes/Lathes/security.yml | 7 ------- 2 files changed, 8 deletions(-) diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 72c6dc3743f..31e132dc691 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -806,7 +806,6 @@ - WeaponLaserCarbinePractice - Zipties - ShockCollar - - ShadowkinRestraints # DeltaV - .38 special ammo - Add various .38 special ammo to security techfab - MagazineBoxSpecial - MagazineBoxSpecialPractice diff --git a/Resources/Prototypes/Recipes/Lathes/security.yml b/Resources/Prototypes/Recipes/Lathes/security.yml index 4a2e737e153..c40419ecc95 100644 --- a/Resources/Prototypes/Recipes/Lathes/security.yml +++ b/Resources/Prototypes/Recipes/Lathes/security.yml @@ -881,10 +881,3 @@ materials: Plastic: 15 Uranium: 10 - -- type: latheRecipe - id: ShadowkinRestraints - result: ClothingOuterShadowkinRestraints - completetime: 6 - materials: - Steel: 300 From 325db03e0aca65199856fe4555923524678ec59a Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sun, 17 Nov 2024 22:05:58 +0100 Subject: [PATCH 11/13] gun --- Content.Shared/Psionics/PsionicComponent.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Shared/Psionics/PsionicComponent.cs b/Content.Shared/Psionics/PsionicComponent.cs index 31211ca4233..299dc71340b 100644 --- a/Content.Shared/Psionics/PsionicComponent.cs +++ b/Content.Shared/Psionics/PsionicComponent.cs @@ -1,3 +1,4 @@ +using Content.Shared.Alert; using Content.Shared.DoAfter; using Content.Shared.Psionics; using Robust.Shared.GameStates; @@ -226,5 +227,8 @@ private set /// [DataField] public int FamiliarLimit = 1; + + [DataField] + public ProtoId ManaAlert = "Mana"; } } From f9940a55ac781ef2dd54187d4e092dc20c7d7e79 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan Date: Sun, 17 Nov 2024 22:09:17 +0100 Subject: [PATCH 12/13] alert --- Content.Server/Psionics/PsionicsSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Psionics/PsionicsSystem.cs b/Content.Server/Psionics/PsionicsSystem.cs index dde94253043..5f43e730ad4 100644 --- a/Content.Server/Psionics/PsionicsSystem.cs +++ b/Content.Server/Psionics/PsionicsSystem.cs @@ -155,7 +155,7 @@ private void OnInit(EntityUid uid, PsionicComponent component, ComponentStartup private void OnRemove(EntityUid uid, PsionicComponent component, ComponentRemove args) { - _alerts.ClearAlert(uid, AlertType.Mana); + _alerts.ClearAlert(uid, component.ManaAlert); if (!HasComp(uid)) return; @@ -166,7 +166,7 @@ private void OnRemove(EntityUid uid, PsionicComponent component, ComponentRemove public void UpdateManaAlert(EntityUid uid, PsionicComponent component) { var severity = (short) ContentHelpers.RoundToLevels(component.Mana, component.MaxMana, 8); - _alerts.ShowAlert(uid, AlertType.Mana, severity); + _alerts.ShowAlert(uid, component.ManaAlert, severity); } private void OnManaUpdate(EntityUid uid, PsionicComponent component, ref OnManaUpdateEvent args) From 34af30d8e148f5336f8183d61821bf1bad08c0f7 Mon Sep 17 00:00:00 2001 From: FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com> Date: Sat, 7 Dec 2024 06:28:35 +0100 Subject: [PATCH 13/13] Apply suggestions from code review Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> Signed-off-by: FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com> --- Content.Shared/Shadowkin/EtherealComponent.cs | 8 ++------ Resources/Locale/en-US/psionics/psionic-powers.ftl | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Content.Shared/Shadowkin/EtherealComponent.cs b/Content.Shared/Shadowkin/EtherealComponent.cs index fdf5c743e4f..113f90df8e6 100644 --- a/Content.Shared/Shadowkin/EtherealComponent.cs +++ b/Content.Shared/Shadowkin/EtherealComponent.cs @@ -23,15 +23,11 @@ public sealed partial class EtherealComponent : Component [DataField] public float DarkenRate = 0.084f; - /// - /// Can be stunned by ethereal stun objects? - /// + /// Can this be stunned by ethereal stun objects? [DataField] public bool CanBeStunned = true; - /// - /// Drain Mana is ent is psionic? - /// + /// Drain Mana if this entity is psionic? [DataField] public bool DrainMana = true; diff --git a/Resources/Locale/en-US/psionics/psionic-powers.ftl b/Resources/Locale/en-US/psionics/psionic-powers.ftl index 86421203c66..ae3cfb383ed 100644 --- a/Resources/Locale/en-US/psionics/psionic-powers.ftl +++ b/Resources/Locale/en-US/psionics/psionic-powers.ftl @@ -171,7 +171,7 @@ power-overwhelming-power-feedback = {CAPITALIZE($entity)} wields a vast connecti action-name-darkswap = DarkSwap action-description-darkswap = Mmra Mamm! darkswap-power-initialization-feedback = - For a short moment, i find myself able to break the realms... phasing in the shadows and the dark, like shadowkins... ready to traval to the darknest of places... + For a short moment, I find myself able to break the realms. Phasing in the shadows and the dark, ready to travel to the darkest of places... ethereal-pickup-fail = My hand sizzles as it passes through... # Psionic Familiar System