using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Mobs;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Shared.Silicons.Bots;
///
/// Used by the server for NPC medibot injection.
/// Currently no clientside prediction done, only exists in shared for emag handling.
///
[RegisterComponent]
[Access(typeof(MedibotSystem))]
public sealed partial class MedibotComponent : Component
{
///
/// Treatments the bot will apply for each mob state.
///
[DataField(required: true)]
public Dictionary Treatments = new();
///
/// Sound played after injecting a patient.
///
[DataField("injectSound")]
public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Items/hypospray.ogg");
}
///
/// An injection to treat the patient with.
///
[DataDefinition]
public sealed partial class MedibotTreatment
{
///
/// Reagent to inject into the patient.
///
[DataField(required: true)]
public ProtoId Reagent = string.Empty;
///
/// How much of the reagent to inject.
///
[DataField(required: true)]
public FixedPoint2 Quantity;
///
/// Do nothing when the patient is at or below this total damage.
/// When null this will inject meds into completely healthy patients.
///
[DataField]
public FixedPoint2? MinDamage;
///
/// Do nothing when the patient is at or above this total damage.
/// Useful for tricordrazine which does nothing above 50 damage.
///
[DataField]
public FixedPoint2? MaxDamage;
///
/// Returns whether the treatment will probably work for an amount of damage.
/// Doesn't account for specific damage types only total amount.
///
public bool IsValid(FixedPoint2 damage)
{
return (MaxDamage == null || damage < MaxDamage) && (MinDamage == null || damage > MinDamage);
}
}