From 8626e82a799b39c6e279d46556db4e65e7dac923 Mon Sep 17 00:00:00 2001 From: Janet Blackquill Date: Wed, 1 Oct 2025 19:48:39 -0400 Subject: [PATCH] The nukies update --- .../_Offbrand/EntityEffects/ClampWounds.cs | 23 ++++++++++ .../EntityEffects/RemoveStatusEffect.cs | 24 +++++++++++ .../_Offbrand/Wounds/WoundComponent.cs | 17 ++++++++ .../_Offbrand/Wounds/WoundableSystem.cs | 27 ++++++++++++ Resources/Locale/en-US/_Offbrand/effects.ftl | 9 ++++ Resources/Locale/en-US/_Offbrand/reagents.ftl | 6 +++ Resources/Prototypes/Reagents/medicine.yml | 3 ++ Resources/Prototypes/_Offbrand/base_mob.yml | 2 +- Resources/Prototypes/_Offbrand/reactions.yml | 24 +++++++++++ Resources/Prototypes/_Offbrand/reagents.yml | 43 +++++++++++++++++++ Resources/Prototypes/_Offbrand/wounds.yml | 1 + 11 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 Content.Shared/_Offbrand/EntityEffects/ClampWounds.cs create mode 100644 Content.Shared/_Offbrand/EntityEffects/RemoveStatusEffect.cs diff --git a/Content.Shared/_Offbrand/EntityEffects/ClampWounds.cs b/Content.Shared/_Offbrand/EntityEffects/ClampWounds.cs new file mode 100644 index 0000000000..01822d37d9 --- /dev/null +++ b/Content.Shared/_Offbrand/EntityEffects/ClampWounds.cs @@ -0,0 +1,23 @@ +using Content.Shared._Offbrand.Wounds; +using Content.Shared.EntityEffects; +using Content.Shared.FixedPoint; +using Robust.Shared.Prototypes; + +namespace Content.Shared._Offbrand.EntityEffects; + +public sealed partial class ClampWounds : EntityEffect +{ + [DataField(required: true)] + public float Chance; + + protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) + { + return Loc.GetString("reagent-effect-guidebook-clamp-wounds", ("probability", Probability), ("chance", Chance)); + } + + public override void Effect(EntityEffectBaseArgs args) + { + args.EntityManager.System() + .ClampWounds(args.TargetEntity, Chance); + } +} diff --git a/Content.Shared/_Offbrand/EntityEffects/RemoveStatusEffect.cs b/Content.Shared/_Offbrand/EntityEffects/RemoveStatusEffect.cs new file mode 100644 index 0000000000..39887e240e --- /dev/null +++ b/Content.Shared/_Offbrand/EntityEffects/RemoveStatusEffect.cs @@ -0,0 +1,24 @@ +using Content.Shared.EntityEffects; +using Content.Shared.StatusEffectNew; +using Robust.Shared.Prototypes; + +namespace Content.Shared._Offbrand.EntityEffects; + +public sealed partial class RemoveStatusEffect : EntityEffect +{ + [DataField(required: true)] + public EntProtoId EffectProto; + + public override void Effect(EntityEffectBaseArgs args) + { + args.EntityManager.System() + .TryRemoveStatusEffect(args.TargetEntity, EffectProto); + } + + /// + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => + Loc.GetString( + "reagent-effect-guidebook-status-effect-remove", + ("chance", Probability), + ("key", prototype.Index(EffectProto).Name)); +} diff --git a/Content.Shared/_Offbrand/Wounds/WoundComponent.cs b/Content.Shared/_Offbrand/Wounds/WoundComponent.cs index 9d007c14d8..76b462b731 100644 --- a/Content.Shared/_Offbrand/Wounds/WoundComponent.cs +++ b/Content.Shared/_Offbrand/Wounds/WoundComponent.cs @@ -102,6 +102,17 @@ public sealed partial class TendableWoundComponent : Component public bool Tended; } +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +[Access(typeof(WoundableSystem))] +public sealed partial class ClampableWoundComponent : Component +{ + /// + /// Whether or not the wound has been clamped + /// + [DataField, AutoNetworkedField] + public bool Clamped; +} + [RegisterComponent, NetworkedComponent] [Access(typeof(WoundableSystem))] public sealed partial class BleedingWoundComponent : Component @@ -166,3 +177,9 @@ public record struct GetBleedLevelEvent(float BleedLevel); /// [ByRefEvent] public record struct ModifyBleedLevelEvent(float BleedLevel); + +/// +/// Raised on an entity's wounds to clamp them with the given probability +/// +[ByRefEvent] +public record struct ClampWoundsEvent(float Probability); diff --git a/Content.Shared/_Offbrand/Wounds/WoundableSystem.cs b/Content.Shared/_Offbrand/Wounds/WoundableSystem.cs index c42ab338ca..b3a04bcd0e 100644 --- a/Content.Shared/_Offbrand/Wounds/WoundableSystem.cs +++ b/Content.Shared/_Offbrand/Wounds/WoundableSystem.cs @@ -5,10 +5,12 @@ using Content.Shared.Damage; using Content.Shared.FixedPoint; using Content.Shared.HealthExaminable; using Content.Shared.IdentityManagement; +using Content.Shared.Random.Helpers; using Content.Shared.StatusEffectNew.Components; using Content.Shared.StatusEffectNew; using Robust.Shared.Network; using Robust.Shared.Prototypes; +using Robust.Shared.Random; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -38,6 +40,7 @@ public sealed class WoundableSystem : EntitySystem SubscribeLocalEvent>(OnGetPain); SubscribeLocalEvent>(OnHealHealableWounds); SubscribeLocalEvent>(OnGetBleedLevel); + SubscribeLocalEvent>(OnClampWounds); } private void OnShutdown(Entity ent, ref ComponentShutdown args) @@ -312,6 +315,9 @@ public sealed class WoundableSystem : EntitySystem if (TryComp(ent, out var tendable) && tendable.Tended) return 0f; + if (TryComp(ent, out var clampable) && clampable.Clamped) + return 0f; + if (wound.Damage.GetTotal() < ent.Comp.StartsBleedingAbove) return 0f; @@ -344,6 +350,27 @@ public sealed class WoundableSystem : EntitySystem return bleedAddition * ratio; } + public void ClampWounds(Entity ent, float probability) + { + var evt = new ClampWoundsEvent(probability); + RaiseLocalEvent(ent, ref evt); + } + + private void OnClampWounds(Entity ent, ref StatusEffectRelayedEvent args) + { + if (ent.Comp.Clamped) + return; + + var seed = SharedRandomExtensions.HashCodeCombine(new() { (int)_timing.CurTick.Value, GetNetEntity(ent).Id }); + var rand = new System.Random(seed); + + if (!rand.Prob(args.Args.Probability)) + return; + + ent.Comp.Clamped = true; + Dirty(ent); + } + private void OnGetBleedLevel(Entity ent, ref StatusEffectRelayedEvent args) { args.Args = args.Args with { BleedLevel = args.Args.BleedLevel + BleedLevel(ent) }; diff --git a/Resources/Locale/en-US/_Offbrand/effects.ftl b/Resources/Locale/en-US/_Offbrand/effects.ftl index 25ba49a187..af82945c16 100644 --- a/Resources/Locale/en-US/_Offbrand/effects.ftl +++ b/Resources/Locale/en-US/_Offbrand/effects.ftl @@ -3,6 +3,11 @@ reagent-guidebook-status-effect = Causes { $effect } during metabolism{ $conditi *[other] {" "}when { $conditions }. } +reagent-effect-guidebook-status-effect-remove = { $chance -> + [1] Removes { LOC($key) } + *[other] remove { LOC($key) } +} + reagent-effect-guidebook-modify-brain-damage-heals = { $chance -> [1] Heals { $amount } brain damage *[other] heal { $amount } brain damage @@ -19,6 +24,10 @@ reagent-effect-guidebook-modify-heart-damage-deals = { $chance -> [1] Deals { $amount } heart damage *[other] deal { $amount } heart damage } +reagent-effect-guidebook-clamp-wounds = { $probability -> + [1] Stops bleeding in wounds with { NATURALPERCENT($chance, 2) } chance per wound + *[other] stop bleeding in wounds with { NATURALPERCENT($chance, 2) } chance per wound +} reagent-effect-condition-guidebook-heart-damage = { $max -> [2147483648] it has at least {NATURALFIXED($min, 2)} heart damage *[other] { $min -> diff --git a/Resources/Locale/en-US/_Offbrand/reagents.ftl b/Resources/Locale/en-US/_Offbrand/reagents.ftl index 9ff2e55e40..9e8e48c47e 100644 --- a/Resources/Locale/en-US/_Offbrand/reagents.ftl +++ b/Resources/Locale/en-US/_Offbrand/reagents.ftl @@ -21,3 +21,9 @@ reagent-desc-peridaxon = A beady medicine that encourages internal organs to rec reagent-name-synthflesh = synthflesh reagent-desc-synthflesh = A resorbable collagen and protein mixture used for synthesizing equivalents to various bodily materials. + +reagent-name-coagulant = coagulant +reagent-desc-coagulant = An experimental medicine that causes internal and external bleeding to clot. Authorities have expressed concern over the lead content. + +reagent-name-osseous = osseous reagent +reagent-desc-osseous = An strange solution of pinkish gel and white shards that can heal internal bone fractures. Authorities have expressed concern over the lead content. diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index be88096011..9f3b7f9ef7 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -836,6 +836,7 @@ color: "#ba7d7d" metabolisms: Medicine: + metabolismRate: 0.2 effects: # Medium-large quantities can hurt you instead, # but still technically stop your bleeding. @@ -848,6 +849,8 @@ damage: types: Bloodloss: 3 + - !type:ClampWounds + chance: 0.3 - type: reagent id: Tricordrazine diff --git a/Resources/Prototypes/_Offbrand/base_mob.yml b/Resources/Prototypes/_Offbrand/base_mob.yml index a80ee2be5c..b8ca40b6bf 100644 --- a/Resources/Prototypes/_Offbrand/base_mob.yml +++ b/Resources/Prototypes/_Offbrand/base_mob.yml @@ -90,7 +90,7 @@ damageProbabilityCoefficient: 0.25 damageProbabilityConstant: 0 - damageTypes: [Slash, Blunt, Piercing] - minimumDamage: 100 + minimumDamage: 120 minimumTotalDamage: 0 woundPrototype: WoundBoneDeath woundDamages: diff --git a/Resources/Prototypes/_Offbrand/reactions.yml b/Resources/Prototypes/_Offbrand/reactions.yml index 1c655e628c..47ec0e8a15 100644 --- a/Resources/Prototypes/_Offbrand/reactions.yml +++ b/Resources/Prototypes/_Offbrand/reactions.yml @@ -103,3 +103,27 @@ amount: 1 products: Romerol: 1 + +- type: reaction + id: Coagulant + reactants: + TranexamicAcid: + amount: 1 + Lead: + amount: 1 + catalyst: true + products: + Coagulant: 1 + +- type: reaction + id: Osseous + reactants: + Milk: + amount: 1 + SodaWater: + amount: 1 + Lead: + amount: 1 + catalyst: true + products: + Osseous: 2 diff --git a/Resources/Prototypes/_Offbrand/reagents.yml b/Resources/Prototypes/_Offbrand/reagents.yml index daacc170e2..20f0e4e834 100644 --- a/Resources/Prototypes/_Offbrand/reagents.yml +++ b/Resources/Prototypes/_Offbrand/reagents.yml @@ -261,3 +261,46 @@ conditions: - !type:ReagentThreshold max: 1 + +- type: reagent + id: Coagulant + name: reagent-name-coagulant + group: Medicine + desc: reagent-desc-coagulant + physicalDesc: reagent-physical-desc-viscous + flavor: metallic + color: "#bf0000" + contrabandSeverity: Syndicate + metabolisms: + Medicine: + metabolismRate: 0.2 + effects: + - !type:ClampWounds + chance: 0.4 + - !type:RemoveStatusEffect + effectProto: WoundArterialBleeding + probability: 0.2 + +- type: reagent + id: Osseous + name: reagent-name-osseous + group: Medicine + desc: reagent-desc-osseous + physicalDesc: reagent-physical-desc-putrid + flavor: meaty + color: "#c9abab" + contrabandSeverity: Syndicate + metabolisms: + Medicine: + effects: + - !type:RemoveStatusEffect + effectProto: WoundFracture + conditions: + - !type:MetaboliteThreshold + min: 5 + - !type:AdjustReagent + reagent: Osseous + amount: -5 + conditions: + - !type:MetaboliteThreshold + min: 5 diff --git a/Resources/Prototypes/_Offbrand/wounds.yml b/Resources/Prototypes/_Offbrand/wounds.yml index d60e665f65..f674b37b0e 100644 --- a/Resources/Prototypes/_Offbrand/wounds.yml +++ b/Resources/Prototypes/_Offbrand/wounds.yml @@ -29,6 +29,7 @@ Cold: 0.2 Caustic: 0.2 - type: TendableWound + - type: ClampableWound - type: BleedingWound bleedingCoefficients: Blunt: 0.015