Epinephrine + epipen (#5444)

* add sprite and basic entity, no reagent or testing

* actually implement epinephrine and add it to the box

* allow creating it

* add it to nanomed

* fig
This commit is contained in:
mirrorcult
2021-11-22 23:51:51 -07:00
committed by GitHub
parent 732baa56a9
commit e2205e418b
39 changed files with 311 additions and 32 deletions

View File

@@ -22,15 +22,15 @@ namespace Content.Server.Chemistry.Components
[RegisterComponent]
public sealed class HyposprayComponent : SharedHyposprayComponent
{
[DataField("ClumsyFailChance")]
[DataField("clumsyFailChance")]
[ViewVariables(VVAccess.ReadWrite)]
public float ClumsyFailChance { get; set; } = 0.5f;
[DataField("TransferAmount")]
[DataField("transferAmount")]
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 TransferAmount { get; set; } = FixedPoint2.New(5);
[DataField("InjectSound")]
[DataField("injectSound")]
private SoundSpecifier _injectSound = new SoundPathSpecifier("/Audio/Items/hypospray.ogg");
protected override void Initialize()

View File

@@ -26,9 +26,6 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
public override bool Condition(ReagentEffectArgs args)
{
if (args.Reagent == null)
return false;
if (Reagent == null)
Reagent = args.Reagent.ID;

View File

@@ -11,7 +11,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.Chemistry.ReagentEffects
{
[UsedImplicitly]
public class RemoveReagent : ReagentEffect
public class AdjustReagent : ReagentEffect
{
/// <summary>
/// The reagent ID to remove. Only one of this and <see cref="Group"/> should be active.
@@ -34,9 +34,12 @@ namespace Content.Server.Chemistry.ReagentEffects
if (args.Source != null)
{
var solutionSys = args.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>();
if (Reagent != null && args.Source.ContainsReagent(Reagent))
if (Reagent != null)
{
solutionSys.TryRemoveReagent(args.SolutionEntity, args.Source, Reagent, Amount);
if (Amount < 0 && args.Source.ContainsReagent(Reagent))
solutionSys.TryRemoveReagent(args.SolutionEntity, args.Source, Reagent, -Amount);
if (Amount > 0)
solutionSys.TryAddReagent(args.SolutionEntity, args.Source, Reagent, Amount, out _);
}
else if (Group != null)
{
@@ -45,7 +48,12 @@ namespace Content.Server.Chemistry.ReagentEffects
{
var proto = prototypeMan.Index<ReagentPrototype>(quant.ReagentId);
if (proto.Metabolisms != null && proto.Metabolisms.ContainsKey(Group))
solutionSys.TryRemoveReagent(args.SolutionEntity, args.Source, quant.ReagentId, Amount);
{
if (Amount < 0)
solutionSys.TryRemoveReagent(args.SolutionEntity, args.Source, quant.ReagentId, Amount);
if (Amount > 0)
solutionSys.TryAddReagent(args.SolutionEntity, args.Source, quant.ReagentId, Amount, out _);
}
}
}
}