From e3ee4a8d3be7a6a4380b0ae2e21da755eb94bd0d Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Thu, 4 Apr 2024 22:45:03 +0900 Subject: [PATCH] Transform sting nerf (#269) * - add: 10 minutes of suffering. * - fix: No monkey evolution. * - fix: Remove Absorb on rejuvenate. * - tweak: Less thick armor. * - fix: Transfer uncloneable on transform. --- .../Changeling/ChangelingSystem.Abilities.cs | 61 +++++++++++++------ Content.Server/Changeling/ChangelingSystem.cs | 8 +++ .../Changeling/TransformStungComponent.cs | 16 +++++ .../Changeling/TransformStungSystem.cs | 39 ++++++++++++ .../Implants/SharedSubdermalImplantSystem.cs | 6 ++ .../Entities/Clothing/OuterClothing/armor.yml | 11 ++-- 6 files changed, 116 insertions(+), 25 deletions(-) create mode 100644 Content.Server/Changeling/TransformStungComponent.cs create mode 100644 Content.Server/Changeling/TransformStungSystem.cs diff --git a/Content.Server/Changeling/ChangelingSystem.Abilities.cs b/Content.Server/Changeling/ChangelingSystem.Abilities.cs index 0c7e36dcc8..a605f77ea9 100644 --- a/Content.Server/Changeling/ChangelingSystem.Abilities.cs +++ b/Content.Server/Changeling/ChangelingSystem.Abilities.cs @@ -424,7 +424,19 @@ public sealed partial class ChangelingSystem _pullingSystem.TryStopPull(pullable); } - TransformPerson(target, humanData); + var oldData = CompOrNull(target)?.OriginalHumanoidData; + + var transformed = TransformPerson(target, humanData); + + if (transformed != null) + { + oldData ??= GetHumanoidData(target); + if (oldData != null) + { + var transformStung = EnsureComp(transformed.Value); + transformStung.OriginalHumanoidData = oldData.Value; + } + } _ui.CloseUi(bui, actorComponent.PlayerSession); @@ -889,19 +901,9 @@ public sealed partial class ChangelingSystem private void CopyHumanoidData(EntityUid uid, EntityUid target, ChangelingComponent component) { - if (!TryComp(target, out var targetMeta)) - return; + var data = GetHumanoidData(target, component); - if (!TryComp(target, out var targetAppearance)) - return; - - if (!TryComp(target, out var targetDna)) - return; - - if (!TryPrototype(target, out var prototype, targetMeta)) - return; - - if (component.AbsorbedEntities.ContainsKey(targetDna.DNA)) + if (data == null) return; /*if (component.AbsorbedEntities.Count == 7) @@ -909,6 +911,28 @@ public sealed partial class ChangelingSystem component.AbsorbedEntities.Remove(component.AbsorbedEntities.ElementAt(2).Key); }*/ + component.AbsorbedEntities.Add(data.Value.Dna, data.Value); + + Dirty(uid, component); + } + + public HumanoidData? GetHumanoidData(EntityUid target, ChangelingComponent? absorberComponent = null) + { + if (!TryComp(target, out var targetMeta)) + return null; + + if (!TryComp(target, out var targetAppearance)) + return null; + + if (!TryComp(target, out var targetDna)) + return null; + + if (!TryPrototype(target, out var prototype, targetMeta)) + return null; + + if (absorberComponent != null && absorberComponent.AbsorbedEntities.ContainsKey(targetDna.DNA)) + return null; + var appearance = _serializationManager.CreateCopy(targetAppearance, notNullableOverride: true); var meta = _serializationManager.CreateCopy(targetMeta, notNullableOverride: true); @@ -916,16 +940,14 @@ public sealed partial class ChangelingSystem ? Loc.GetString("changeling-unknown-creature") : meta.EntityName; - component.AbsorbedEntities.Add(targetDna.DNA, new HumanoidData + return new HumanoidData { EntityPrototype = prototype, MetaDataComponent = meta, AppearanceComponent = appearance, Name = name, Dna = targetDna.DNA - }); - - Dirty(uid, component); + }; } /// @@ -935,7 +957,7 @@ public sealed partial class ChangelingSystem /// Transform data /// Override first check on HumanoidAppearanceComponent /// Id of the transformed entity - private EntityUid? TransformPerson(EntityUid target, HumanoidData transformData, bool humanoidOverride = false) + public EntityUid? TransformPerson(EntityUid target, HumanoidData transformData, bool humanoidOverride = false) { if (!HasComp(target) && !humanoidOverride) return null; @@ -1005,6 +1027,9 @@ public sealed partial class ChangelingSystem if (HasComp(from)) EnsureComp(to); + if (HasComp(from)) + EnsureComp(to); + if (HasComp(from)) EnsureComp(to); diff --git a/Content.Server/Changeling/ChangelingSystem.cs b/Content.Server/Changeling/ChangelingSystem.cs index 94a34a2ba2..2670b0f600 100644 --- a/Content.Server/Changeling/ChangelingSystem.cs +++ b/Content.Server/Changeling/ChangelingSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Examine; using Content.Shared.IdentityManagement; using Content.Shared.Implants; using Content.Shared.Implants.Components; +using Content.Shared.Rejuvenate; namespace Content.Server.Changeling; @@ -23,6 +24,7 @@ public sealed partial class ChangelingSystem : EntitySystem SubscribeLocalEvent(OnInit); SubscribeLocalEvent(OnExamine); + SubscribeLocalEvent(OnRejuvenate); InitializeAbilities(); InitializeShop(); @@ -45,6 +47,12 @@ public sealed partial class ChangelingSystem : EntitySystem args.PushMarkup(Loc.GetString("changeling-juices-sucked-up", ("target", Identity.Entity(uid, EntityManager)))); } + private void OnRejuvenate(Entity ent, ref RejuvenateEvent args) + { + RemCompDeferred(ent); + RemCompDeferred(ent); + } + #endregion #region Helpers diff --git a/Content.Server/Changeling/TransformStungComponent.cs b/Content.Server/Changeling/TransformStungComponent.cs new file mode 100644 index 0000000000..f0333d413a --- /dev/null +++ b/Content.Server/Changeling/TransformStungComponent.cs @@ -0,0 +1,16 @@ +using Content.Shared.Changeling; + +namespace Content.Server.Changeling; + +[RegisterComponent] +public sealed partial class TransformStungComponent : Component +{ + [ViewVariables] + public HumanoidData OriginalHumanoidData; + + [DataField] + public TimeSpan Duration = TimeSpan.FromMinutes(10); + + [ViewVariables] + public float Accumulator; +} diff --git a/Content.Server/Changeling/TransformStungSystem.cs b/Content.Server/Changeling/TransformStungSystem.cs new file mode 100644 index 0000000000..63a92b056c --- /dev/null +++ b/Content.Server/Changeling/TransformStungSystem.cs @@ -0,0 +1,39 @@ +using Content.Server.Forensics; +using Content.Shared.Mobs; +using Content.Shared.Mobs.Components; + +namespace Content.Server.Changeling; + +public sealed class TransformStungSystem : EntitySystem +{ + [Dependency] private readonly ChangelingSystem _ling = default!; + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var stung, out var state, out var dna)) + { + if (dna.DNA == stung.OriginalHumanoidData.Dna) + { + RemCompDeferred(uid); + continue; + } + + if (state.CurrentState != MobState.Alive) + continue; + + stung.Accumulator += frameTime; + + if (stung.Accumulator < stung.Duration.TotalSeconds) + continue; + + stung.Accumulator = 0f; + + _ling.TransformPerson(uid, stung.OriginalHumanoidData); + + RemCompDeferred(uid); + } + } +} diff --git a/Content.Shared/Implants/SharedSubdermalImplantSystem.cs b/Content.Shared/Implants/SharedSubdermalImplantSystem.cs index e5ba0a1961..f4b580f8ed 100644 --- a/Content.Shared/Implants/SharedSubdermalImplantSystem.cs +++ b/Content.Shared/Implants/SharedSubdermalImplantSystem.cs @@ -5,10 +5,12 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Mindshield.Components; using Content.Shared.Mobs; +using Content.Shared.Store; using Content.Shared.Tag; using JetBrains.Annotations; using Robust.Shared.Containers; using Robust.Shared.Network; +using Robust.Shared.Player; namespace Content.Shared.Implants; @@ -18,6 +20,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly TagSystem _tag = default!; + [Dependency] private readonly SharedUserInterfaceSystem _ui = default!; // WD public const string BaseStorageId = "storagebase"; @@ -225,6 +228,9 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem // Insert the implant into the recipient's implant container ForceImplant(recipient, donorImplant, subdermal, true); + + if (TryComp(recipient, out ActorComponent? actor)) + _ui.TryClose(donorImplant, StoreUiKey.Key, actor.PlayerSession); } } diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml index 2c2e15a9ab..7f26f57d67 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml @@ -165,16 +165,13 @@ - type: Armor modifiers: coefficients: - Blunt: 0.4 - Slash: 0.4 - Piercing: 0.5 - Heat: 0.4 + Blunt: 0.5 + Slash: 0.5 + Piercing: 0.6 + Heat: 0.5 - type: ExplosionResistance damageCoefficient: 0.5 - type: GroupExamine - - type: ClothingSpeedModifier - walkModifier: 0.85 - sprintModifier: 0.85 - type: Unremoveable deleteOnDrop: true - type: ClothingModifyChemicalRegen