From fb665836ce330769933a09359cef86d48bab5497 Mon Sep 17 00:00:00 2001 From: Nix Silvam Date: Fri, 28 Jun 2024 21:52:49 +0300 Subject: [PATCH 1/4] added myiopia trait --- .../ADT/Traits/Assorted/MyiopiaComponent.cs | 16 ++++++ .../ADT/Traits/Assorted/MyiopiaSystem.cs | 52 +++++++++++++++++++ Resources/Prototypes/ADT/Traits/neutral.yml | 13 +++++ 3 files changed, 81 insertions(+) create mode 100644 Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs create mode 100644 Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs create mode 100644 Resources/Prototypes/ADT/Traits/neutral.yml diff --git a/Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs b/Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs new file mode 100644 index 00000000000..b3955fe3d8a --- /dev/null +++ b/Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs @@ -0,0 +1,16 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Traits.Assorted; + +/// +/// This is used for making something blind forever. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class MyiopiaComponent : Component +{ + [DataField] + public int EyeDamage = 3; + + public bool Active = true; +} + diff --git a/Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs b/Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs new file mode 100644 index 00000000000..f4ba13e1f83 --- /dev/null +++ b/Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs @@ -0,0 +1,52 @@ +using Content.Shared.Damage.Components; +using Content.Shared.Examine; +using Content.Shared.Eye.Blinding.Components; +using Content.Shared.Eye.Blinding.Systems; +using Content.Shared.IdentityManagement; +using Robust.Shared.Network; + +namespace Content.Shared.Traits.Assorted; + +/// +/// This handles permanent blindness, both the examine and the actual effect. +/// +public sealed class MyiopiaSystem : EntitySystem +{ + [Dependency] private readonly INetManager _net = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly BlindableSystem _blinding = default!; + + /// + public override void Initialize() + { + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnDamageChanged); + + } + + private void OnStartup(EntityUid uid, MyiopiaComponent component, ComponentStartup args) + { + if (!TryComp(uid, out var blindable)) + return; + _blinding.AdjustEyeDamage((uid, blindable), component.EyeDamage); + } + + private void OnShutdown(EntityUid uid, MyiopiaComponent component, ComponentShutdown args) + { + if (!TryComp(uid, out var blindable)) + return; + _blinding.AdjustEyeDamage((uid, blindable), -component.EyeDamage); + } + + private void OnDamageChanged(EntityUid uid, MyiopiaComponent component, ref EyeDamageChangedEvent args) + { + if (!TryComp(uid, out var blindable)) + return; + if (!component.Active) + return; + if (blindable.EyeDamage < component.EyeDamage) + _blinding.AdjustEyeDamage((uid, blindable), (component.EyeDamage - blindable.EyeDamage)); + + } +} diff --git a/Resources/Prototypes/ADT/Traits/neutral.yml b/Resources/Prototypes/ADT/Traits/neutral.yml new file mode 100644 index 00000000000..e54f350ce3e --- /dev/null +++ b/Resources/Prototypes/ADT/Traits/neutral.yml @@ -0,0 +1,13 @@ +- type: trait + id: ADTMothAccent + name: trait-moth-accent-name + description: trait-moth-accent-desc + components: + - type: MothAccent + +- type: trait + id: ADTMyiopia + name: trait-nearsighted-name + description: trait-nearsighted-description + components: + - type: Myiopia From 637f42947f9098b64c1fd8b9fd40b6d6ee221da4 Mon Sep 17 00:00:00 2001 From: Nix Silvam Date: Fri, 28 Jun 2024 22:06:06 +0300 Subject: [PATCH 2/4] added myopia trait --- .../{MyiopiaComponent.cs => MyopiaComponent.cs} | 2 +- .../Assorted/{MyiopiaSystem.cs => MyopiaSystem.cs} | 14 +++++++------- Resources/Prototypes/ADT/Traits/neutral.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) rename Content.Shared/ADT/Traits/Assorted/{MyiopiaComponent.cs => MyopiaComponent.cs} (83%) rename Content.Shared/ADT/Traits/Assorted/{MyiopiaSystem.cs => MyopiaSystem.cs} (69%) diff --git a/Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs b/Content.Shared/ADT/Traits/Assorted/MyopiaComponent.cs similarity index 83% rename from Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs rename to Content.Shared/ADT/Traits/Assorted/MyopiaComponent.cs index b3955fe3d8a..377fe02b8a1 100644 --- a/Content.Shared/ADT/Traits/Assorted/MyiopiaComponent.cs +++ b/Content.Shared/ADT/Traits/Assorted/MyopiaComponent.cs @@ -6,7 +6,7 @@ namespace Content.Shared.Traits.Assorted; /// This is used for making something blind forever. /// [RegisterComponent, NetworkedComponent] -public sealed partial class MyiopiaComponent : Component +public sealed partial class MyopiaComponent : Component { [DataField] public int EyeDamage = 3; diff --git a/Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs b/Content.Shared/ADT/Traits/Assorted/MyopiaSystem.cs similarity index 69% rename from Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs rename to Content.Shared/ADT/Traits/Assorted/MyopiaSystem.cs index f4ba13e1f83..a1c1a08a59d 100644 --- a/Content.Shared/ADT/Traits/Assorted/MyiopiaSystem.cs +++ b/Content.Shared/ADT/Traits/Assorted/MyopiaSystem.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Traits.Assorted; /// /// This handles permanent blindness, both the examine and the actual effect. /// -public sealed class MyiopiaSystem : EntitySystem +public sealed class MyopiaSystem : EntitySystem { [Dependency] private readonly INetManager _net = default!; [Dependency] private readonly IEntityManager _entityManager = default!; @@ -19,27 +19,27 @@ public sealed class MyiopiaSystem : EntitySystem /// public override void Initialize() { - SubscribeLocalEvent(OnStartup); - SubscribeLocalEvent(OnShutdown); - SubscribeLocalEvent(OnDamageChanged); + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnDamageChanged); } - private void OnStartup(EntityUid uid, MyiopiaComponent component, ComponentStartup args) + private void OnStartup(EntityUid uid, MyopiaComponent component, ComponentStartup args) { if (!TryComp(uid, out var blindable)) return; _blinding.AdjustEyeDamage((uid, blindable), component.EyeDamage); } - private void OnShutdown(EntityUid uid, MyiopiaComponent component, ComponentShutdown args) + private void OnShutdown(EntityUid uid, MyopiaComponent component, ComponentShutdown args) { if (!TryComp(uid, out var blindable)) return; _blinding.AdjustEyeDamage((uid, blindable), -component.EyeDamage); } - private void OnDamageChanged(EntityUid uid, MyiopiaComponent component, ref EyeDamageChangedEvent args) + private void OnDamageChanged(EntityUid uid, MyopiaComponent component, ref EyeDamageChangedEvent args) { if (!TryComp(uid, out var blindable)) return; diff --git a/Resources/Prototypes/ADT/Traits/neutral.yml b/Resources/Prototypes/ADT/Traits/neutral.yml index e54f350ce3e..f1f88e9563e 100644 --- a/Resources/Prototypes/ADT/Traits/neutral.yml +++ b/Resources/Prototypes/ADT/Traits/neutral.yml @@ -6,8 +6,8 @@ - type: MothAccent - type: trait - id: ADTMyiopia + id: ADTMyopia name: trait-nearsighted-name description: trait-nearsighted-description components: - - type: Myiopia + - type: Myopia From ae378016b9323ab90d78d5021a285a2d4f682d2f Mon Sep 17 00:00:00 2001 From: Nix Silvam Date: Fri, 28 Jun 2024 22:06:32 +0300 Subject: [PATCH 3/4] glasses healing myopia --- .../ADT/Glasses/GlassesComponent.cs | 13 +++++ Content.Shared/ADT/Glasses/GlassesSystem.cs | 49 +++++++++++++++++++ .../Entities/Clothing/Eyes/glasses.yml | 1 + 3 files changed, 63 insertions(+) create mode 100644 Content.Shared/ADT/Glasses/GlassesComponent.cs create mode 100644 Content.Shared/ADT/Glasses/GlassesSystem.cs diff --git a/Content.Shared/ADT/Glasses/GlassesComponent.cs b/Content.Shared/ADT/Glasses/GlassesComponent.cs new file mode 100644 index 00000000000..cadce4a972c --- /dev/null +++ b/Content.Shared/ADT/Glasses/GlassesComponent.cs @@ -0,0 +1,13 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Traits.Assorted; + +/// +/// This is used for making something blind forever. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class GlassesComponent : Component +{ + +} + diff --git a/Content.Shared/ADT/Glasses/GlassesSystem.cs b/Content.Shared/ADT/Glasses/GlassesSystem.cs new file mode 100644 index 00000000000..b1f07bfdbc1 --- /dev/null +++ b/Content.Shared/ADT/Glasses/GlassesSystem.cs @@ -0,0 +1,49 @@ +using Content.Shared.Damage.Components; +using Content.Shared.Examine; +using Content.Shared.Eye.Blinding.Components; +using Content.Shared.Eye.Blinding.Systems; +using Content.Shared.IdentityManagement; +using Robust.Shared.Network; +using Content.Shared.Inventory.Events; +using Content.Shared.Inventory; +using Content.Shared.Traits.Assorted; + +namespace Content.Shared.Traits.Assorted; + +/// +/// This handles permanent blindness, both the examine and the actual effect. +/// +public sealed class GlassesSystem : EntitySystem +{ + [Dependency] private readonly INetManager _net = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly BlindableSystem _blinding = default!; + + /// + public override void Initialize() + { + SubscribeLocalEvent(Equipped); + SubscribeLocalEvent(Unequipped); + + } + + private void Equipped(EntityUid uid, GlassesComponent component, ref GotEquippedEvent args) + { + if (!TryComp(args.Equipee, out var myopia)) + return; + myopia.Active = false; + if (!TryComp(args.Equipee, out var blindable)) + return; + _blinding.AdjustEyeDamage((args.Equipee, blindable), -myopia.EyeDamage); + } + + private void Unequipped(EntityUid uid, GlassesComponent component, ref GotUnequippedEvent args) + { + if (!TryComp(args.Equipee, out var myopia)) + return; + myopia.Active = true; + if (!TryComp(args.Equipee, out var blindable)) + return; + _blinding.AdjustEyeDamage((args.Equipee, blindable), myopia.EyeDamage); + } +} diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml index 7ad21ba93aa..d10c2a7d584 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml @@ -70,6 +70,7 @@ name: glasses description: A pair of spectacular spectacles with prescription lenses. components: + - type: Glasses - type: Sprite sprite: Clothing/Eyes/Glasses/glasses.rsi - type: Clothing From 8a244d8a4ae2762b20cba458fa4a59cbfa23b83e Mon Sep 17 00:00:00 2001 From: themanyfaceddemon Date: Mon, 1 Jul 2024 15:36:38 +0300 Subject: [PATCH 4/4] fuck u --- Resources/Prototypes/ADT/Traits/neutral.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 Resources/Prototypes/ADT/Traits/neutral.yml diff --git a/Resources/Prototypes/ADT/Traits/neutral.yml b/Resources/Prototypes/ADT/Traits/neutral.yml deleted file mode 100644 index f1f88e9563e..00000000000 --- a/Resources/Prototypes/ADT/Traits/neutral.yml +++ /dev/null @@ -1,13 +0,0 @@ -- type: trait - id: ADTMothAccent - name: trait-moth-accent-name - description: trait-moth-accent-desc - components: - - type: MothAccent - -- type: trait - id: ADTMyopia - name: trait-nearsighted-name - description: trait-nearsighted-description - components: - - type: Myopia