Files
wwdpublic/Content.Server/EntityEffects/Effects/StatusEffects/GenericStatusEffect.cs
GNUtopia 31457e3f85 Chem Tweaks (#2293)
Makes an assortment of changes related to chems.
Morphine has been made more accessible at roundstart, adding a pain pen
to the prefilled advanced medical belt and swapping a pain pen for a
morphine bottle in the prefilled syringe case. Morphine also now blocks
pain for longer, hopefully alleviating an issue where the effect would
wear off during heart transplants. Also fixes an error which required
the patient to have *both* ForcedSleep and NoScream to block the surgery
pain moodlet. Additionally adds a morphine autoinjector cartridge.
Adds enunciase, which removes stuttering statuses and temporarily
disables all accents, and formic acid, which can react to make water or
enunciase.
Haloperidol also now removes less severe stuttering and ousiana dust now
removes psionic insulation and power blocking statuses.
Salicylic acid now works on corpses to reflect the description.
Additionally fixes a missing locale from the Goob chem port and tweaks
the text for the proto medical multitool.

---

<details><summary><h1>Media</h1></summary>
<p>

![formic
acid](https://github.com/user-attachments/assets/7344bfec-4bb0-4b6c-9182-0b3ca2bce111)

![enunciase](https://github.com/user-attachments/assets/46ded0e3-39ea-4943-bcd8-d1721de81052)

![haloperidol](https://github.com/user-attachments/assets/04d67bc9-ce7b-49b8-82b5-fbc9ee5b83b1)
![ousiana
dust](https://github.com/user-attachments/assets/5cb1a0b4-5591-492d-88ce-9717b6606cbb)

![morphine](https://github.com/user-attachments/assets/78893dc4-805d-4adf-8804-1db5aeb9020f)
![updated stamina change
text](https://github.com/user-attachments/assets/acba97d3-35a8-4b52-a04f-f76aeea4e183)
![tweaked appearances for morphine and
artiplates](https://github.com/user-attachments/assets/09864b45-25af-4dda-b61b-91fbe114d5dc)
(dylovene to the left for comparison)
![enunciase being
used](https://github.com/user-attachments/assets/99f1fdac-9c9c-4746-9994-9b31a2eaede9)
![formic acid reacting with sulfuric
acid](https://github.com/user-attachments/assets/f530fdf6-be8f-4add-aa9b-4e606f572907)
![morphine ACTUALLY blocking the moodlet this
time](https://github.com/user-attachments/assets/919c70f0-8ab0-4ffa-be70-da7114194322)

</p>

</details>

---

🆑
- add: Added formic acid
- add: Added enunciase
- add: Added morphine autoinjector cartridge
- tweak: Haloperidol now counteracts stuttering from chems
- tweak: Ousiana dust now counteracts psionic insulation/blocking
statuses
- tweak: Morphine blocks pain for longer
- tweak: Morphine and artiplates are more visually distinct
- tweak: Increased distribution of morphine roundstart
- tweak: Changed wording of stamina change effect
- tweak: Salicylic acid works on corpses
- fix: Fixed missing locale text for some stamina-affecting chems
- fix: Fixed guidebook falsely saying effects accumulate
- fix: Fixed capitalisation of proto medical multitool
- fix: Fixed morphine not blocking surgery pain moodlet

---------

Signed-off-by: GNUtopia <93669372+GNUtopia@users.noreply.github.com>

      - CartridgePain # Morphine Tweaks#
2025-07-20 13:09:28 +10:00

79 lines
2.5 KiB
C#

using Content.Shared.Chemistry.Reagent;
using Content.Shared.EntityEffects;
using Content.Shared.StatusEffect;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.Effects.StatusEffects;
/// <summary>
/// Adds a generic status effect to the entity,
/// not worrying about things like how to affect the time it lasts for
/// or component fields or anything. Just adds a component to an entity
/// for a given time. Easy.
/// </summary>
/// <remarks>
/// Can be used for things like adding accents or something. I don't know. Go wild.
/// </remarks>
[UsedImplicitly]
public sealed partial class GenericStatusEffect : EntityEffect
{
[DataField(required: true)]
public string Key = default!;
[DataField]
public string Component = String.Empty;
[DataField]
public float Time = 2.0f;
/// <remarks>
/// true - refresh status effect time, false - accumulate status effect time
/// </remarks>
[DataField]
public bool Refresh = true;
/// <summary>
/// Should this effect add the status effect, remove time from it, or set its cooldown?
/// </summary>
[DataField]
public StatusEffectMetabolismType Type = StatusEffectMetabolismType.Add;
public override void Effect(EntityEffectBaseArgs args)
{
var statusSys = args.EntityManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>();
var time = Time;
if (args is EntityEffectReagentArgs reagentArgs)
time *= reagentArgs.Scale.Float();
if (Type == StatusEffectMetabolismType.Add && Component != String.Empty)
{
statusSys.TryAddStatusEffect(args.TargetEntity, Key, TimeSpan.FromSeconds(time), Refresh, Component);
}
else if (Type == StatusEffectMetabolismType.Remove)
{
statusSys.TryRemoveTime(args.TargetEntity, Key, TimeSpan.FromSeconds(time));
}
else if (Type == StatusEffectMetabolismType.Set)
{
statusSys.TrySetTime(args.TargetEntity, Key, TimeSpan.FromSeconds(time));
}
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString(
"reagent-effect-guidebook-status-effect",
("chance", Probability),
("type", Type),
("refresh", Refresh),
("time", Time),
("key", $"reagent-effect-status-effect-{Key}"));
}
public enum StatusEffectMetabolismType
{
Add,
Remove,
Set
}