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

@@ -21,8 +21,6 @@ namespace Content.Client.Chemistry.Visualizers
{
base.OnChangeData(component);
if (_maxFillLevels <= 0 || _fillBaseName == null) return;
if (!component.TryGetData(SolutionContainerVisuals.VisualState,
out SolutionContainerVisualState state)) return;
@@ -34,6 +32,8 @@ namespace Content.Client.Chemistry.Visualizers
if (closestFillSprite > 0)
{
if (_fillBaseName == null) return;
sprite.LayerSetVisible(fillLayer, true);
var stateName = _fillBaseName + closestFillSprite;

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 _);
}
}
}
}

View File

@@ -4,6 +4,7 @@ using Content.Shared.FixedPoint;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Chemistry.Components
{
@@ -11,7 +12,9 @@ namespace Content.Shared.Chemistry.Components
public abstract class SharedHyposprayComponent : Component
{
public sealed override string Name => "Hypospray";
public const string SolutionName = "hypospray";
[DataField("solutionName")]
public string SolutionName = "hypospray";
[Serializable, NetSerializable]
protected sealed class HyposprayComponentState : ComponentState

View File

@@ -332,11 +332,14 @@ namespace Content.Shared.StatusEffect
/// <param name="time">The amount of time to add.</param>
/// <param name="status">The status effect component, should you already have it.</param>
public bool TryAddTime(EntityUid uid, string key, TimeSpan time,
StatusEffectsComponent? status = null)
StatusEffectsComponent? status=null,
SharedAlertsComponent? alert=null)
{
if (!Resolve(uid, ref status, false))
return false;
Resolve(uid, ref alert, false);
if (!HasStatusEffect(uid, key, status))
return false;
@@ -344,6 +347,14 @@ namespace Content.Shared.StatusEffect
timer.Item2 += time;
status.ActiveEffects[key].Cooldown = timer;
if (_prototypeManager.TryIndex<StatusEffectPrototype>(key, out var proto)
&& alert != null
&& proto.Alert != null)
{
alert.ShowAlert(proto.Alert.Value, cooldown: GetAlertCooldown(uid, proto.Alert.Value, status));
}
return true;
}
@@ -355,11 +366,14 @@ namespace Content.Shared.StatusEffect
/// <param name="time">The amount of time to add.</param>
/// <param name="status">The status effect component, should you already have it.</param>
public bool TryRemoveTime(EntityUid uid, string key, TimeSpan time,
StatusEffectsComponent? status = null)
StatusEffectsComponent? status=null,
SharedAlertsComponent? alert=null)
{
if (!Resolve(uid, ref status, false))
return false;
Resolve(uid, ref alert, false);
if (!HasStatusEffect(uid, key, status))
return false;
@@ -372,6 +386,14 @@ namespace Content.Shared.StatusEffect
timer.Item2 -= time;
status.ActiveEffects[key].Cooldown = timer;
if (_prototypeManager.TryIndex<StatusEffectPrototype>(key, out var proto)
&& alert != null
&& proto.Alert != null)
{
alert.ShowAlert(proto.Alert.Value, cooldown: GetAlertCooldown(uid, proto.Alert.Value, status));
}
return true;
}

View File

@@ -94,7 +94,7 @@
contents:
- id: ClothingMaskBreath
- id: EmergencyOxygenTankFilled
#- name: Injector
- id: EpinephrineMedipen
- type: Sprite
layers:
- state: box
@@ -102,8 +102,8 @@
- type: Item
size: 15
- type: Storage
capacity: 15
size: 15
capacity: 20
size: 25
- type: entity
name: box of hugs

View File

@@ -6,3 +6,5 @@
startingInventory:
Brutepack: 5
Ointment: 5
EpinephrineChemistryBottle: 3
Syringe: 5

View File

@@ -5,3 +5,5 @@
startingInventory:
Brutepack: 5
Ointment: 5
EpinephrineChemistryBottle: 3
Syringe: 5

View File

@@ -18,3 +18,48 @@
- type: ExaminableSolution
solution: hypospray
- type: Hypospray
- type: entity
name: chemical medipen
parent: BaseItem
description: A sterile injector for rapid administration of drugs to patients. This one can't be refilled.
id: ChemicalMedipen
components:
- type: Sprite
sprite: Objects/Specific/Medical/medipen.rsi
netsync: false
layers:
- state: medipen
map: ["enum.SolutionContainerLayers.Fill"]
- type: Item
sprite: Objects/Specific/Medical/medipen.rsi
size: 5
- type: SolutionContainerManager
solutions:
pen:
maxVol: 15
- type: ExaminableSolution
solution: pen
- type: Hypospray
solutionName: pen
transferAmount: 15
- type: Appearance
visuals:
- type: SolutionContainerVisualizer
maxFillLevels: 1
changeColor: false
emptySpriteName: medipen_empty
- type: entity
name: epinephrine medipen
parent: ChemicalMedipen
id: EpinephrineMedipen
description: A rapid and safe way to stabilize patients in critical condition for personnel without advanced medical knowledge. Beware, as it's easy to overdose on epinephrine.
components:
- type: SolutionContainerManager
solutions:
pen:
maxVol: 15
reagents:
- ReagentId: Epinephrine
Quantity: 15

View File

@@ -109,3 +109,17 @@
- type: SolutionContainerVisualizer
maxFillLevels: 6
fillBaseName: bottle-4-
- type: entity
id: EpinephrineChemistryBottle
name: epinephrine bottle
parent: BaseChemistryEmptyBottle
components:
- type: SolutionContainerManager
solutions:
drink: # This solution name and target volume is hard-coded in ChemMasterComponent
maxVol: 30
reagents:
- ReagentId: Epinephrine
Quantity: 30

View File

@@ -0,0 +1,17 @@
- type: reagent
id: Acetone
name: acetone
desc: A slick, slightly carcinogenic liquid. Has a multitude of mundane uses in everyday life.
physicalDesc: acidic
color: "#AF14B7"
boilingPoint: 55.5
meltingPoint: -50.0
- type: reagent
id: Phenol
name: phenol
desc: An aromatic ring of carbon with a hydroxyl group. A useful precursor to some medicines, but has no healing properties on its own.
physicalDesc: acidic
color: "#E7EA91"
boilingPoint: 55.5
meltingPoint: -50.0

View File

@@ -43,9 +43,9 @@
metabolisms:
Medicine:
effects:
- !type:RemoveReagent
- !type:AdjustReagent
reagent: Histamine
amount: 3.0
amount: -3.0
- !type:GenericStatusEffect
key: Jitter
time: 1.0
@@ -180,6 +180,66 @@
color: "#2d5708"
# TODO: GenericStatusEffect remove drunkenness
# this ones a doozy
- type: reagent
id: Epinephrine
name: epinephrine
desc: Effective at bringing people back from a critical state. Reduces some stun times. Easy to overdose on.
physicalDesc: odorless
color: "#d2fffa"
metabolisms:
Medicine:
effects:
- !type:HealthChange
conditions:
- !type:TotalDamage
# they gotta be in crit first
min: 100
- !type:ReagentThreshold
min: 0
max: 20
damage:
types:
Asphyxiation: -3
Poison: -0.5
groups:
Brute: -0.5
Burn: -0.5
- !type:HealthChange
conditions:
- !type:ReagentThreshold
min: 20
damage:
types:
Asphyxiation: 1
Poison: 1
- !type:AdjustReagent
reagent: Lexorin
amount: -2
- !type:AdjustReagent
conditions:
- !type:ReagentThreshold
reagent: Lexorin
min: 1
reagent: Epinephrine
amount: -1
- !type:AdjustReagent
probability: 0.1
conditions:
- !type:ReagentThreshold
reagent: Lexorin
min: 1
reagent: Histamine
amount: 4
- !type:GenericStatusEffect
key: Stun
time: 0.25
type: Remove
- !type:GenericStatusEffect
key: KnockedDown
time: 0.25
type: Remove
- type: reagent
id: Hyperzine
name: hyperzine

View File

@@ -112,9 +112,9 @@
damage:
types:
Poison: 3
- !type:RemoveReagent
- !type:AdjustReagent
reagent: Inaprovaline
amount: 2
amount: -2.0
reactiveEffects:
Flammable:
methods: [ Touch ]

View File

@@ -18,6 +18,30 @@
products:
Diethylamine: 2
- type: reaction
id: Phenol
reactants:
Water:
amount: 1
Chlorine:
amount: 1
Oil:
amount: 1
products:
Phenol: 3
- type: reaction
id: Acetone
reactants:
Oil:
amount: 1
WeldingFuel:
amount: 1
Oxygen:
amount: 1
products:
Acetone: 2
- type: reaction
id: FoamingAgent
reactants:
@@ -206,16 +230,6 @@
products:
UnstableMutagen: 3
- type: reaction
id: Water
reactants:
Hydrogen:
amount: 1
Oxygen:
amount: 1
products:
Water: 2
- type: reaction
id: Oil
reactants:

View File

@@ -66,6 +66,24 @@
products:
Cryoxadone: 3
- type: reaction
id: Epinephrine
reactants:
Phenol:
amount: 1
Acetone:
amount: 1
Diethylamine:
amount: 1
Oxygen:
amount: 1
Chlorine:
amount: 1
Hydrogen:
amount: 1
products:
Epinephrine: 6
- type: reaction
id: Clonexadone
reactants:

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View File

@@ -0,0 +1,77 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "tgstation at 986af32e22a88dae14fd147d812a5a4d27c1bc30",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "medipen"
},
{
"name": "firstaid"
},
{
"name": "firstaid_empty"
},
{
"name": "hypovolemic"
},
{
"name": "hypovolemic_empty"
},
{
"name": "medipen_empty"
},
{
"name": "stimpen"
},
{
"name": "stimpen_empty"
},
{
"name": "morphen"
},
{
"name": "morphen_empty"
},
{
"name": "oxapen"
},
{
"name": "oxapen_empty"
},
{
"name": "penacid"
},
{
"name": "penacid_empty"
},
{
"name": "salacid"
},
{
"name": "salacid_empty"
},
{
"name": "salpen"
},
{
"name": "salpen_empty"
},
{
"name": "atropen"
},
{
"name": "atropen_empty"
},
{
"name": "medipen-inhand-left"
},
{
"name": "medipen-inhand-right"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B