CatStation/Content.Shared/EntityEffects/Effects/Body/AddReagentToBloodstreamEntityEffectSystem.cs
Pok 61f98c14d3
Changeling reagent stings (#43805)
* Changeling-Stings

* update yml

* attempt failed dead

* sprite and ChangelingNeurodepressantSting

* Update changeling_catalog.yml

* merge

* update

* review

* review 2

* clean up, remove non-blind stings

* fix stuff

* lethal, cryogenic, hallucination + armblade  nerf

* validate deez

* a

* review

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2026-06-04 19:29:21 +00:00

51 lines
2 KiB
C#

using Content.Shared.Body.Components;
using Content.Shared.Body.Systems;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects.Effects.Body;
/// <summary>
/// Adds a reagent directly to the target's bloodstream.
/// Quantity is modified by scale.
/// </summary>
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
public sealed partial class AddReagentToBloodstreamEntityEffectSystem : EntityEffectSystem<BloodstreamComponent, AddReagentToBloodstream>
{
[Dependency] private SharedBloodstreamSystem _bloodstream = default!;
[Dependency] private ReactiveSystem _reactive = default!;
protected override void Effect(Entity<BloodstreamComponent> entity, ref EntityEffectEvent<AddReagentToBloodstream> args)
{
var solution = new Content.Shared.Chemistry.Components.Solution();
solution.AddReagent(args.Effect.Reagent, args.Effect.Quantity * args.Scale);
_bloodstream.TryAddToBloodstream(entity.AsNullable(), solution);
_reactive.DoEntityReaction(entity, solution, ReactionMethod.Injection); // TODO: This should be part of TryAddToBloodstream
}
}
/// <inheritdoc cref="EntityEffect"/>
public sealed partial class AddReagentToBloodstream : EntityEffectBase<AddReagentToBloodstream>
{
/// <summary>
/// Prototype of the reagent we're adding.
/// </summary>
[DataField(required: true)]
public ProtoId<ReagentPrototype> Reagent;
/// <summary>
/// Amount of reagent to add to the bloodstream.
/// </summary>
[DataField]
public FixedPoint2 Quantity = 1.0;
public override string? EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
return prototype.Resolve(Reagent, out var proto)
? Loc.GetString("entity-effect-guidebook-add-reagent-to-bloodstream", ("chance", Probability), ("reagent", proto.LocalizedName), ("quantity", Quantity))
: null;
}
}