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

@@ -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;
}