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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user