Files
OldThink/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs

57 lines
1.7 KiB
C#
Raw Normal View History

using System;
using Content.Shared.FixedPoint;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
2021-06-09 22:19:39 +02:00
namespace Content.Shared.Chemistry.Reagent
{
public enum ReactionMethod
{
Touch,
Injection,
Ingestion,
}
2021-07-31 01:59:18 -07:00
[ImplicitDataDefinitionForInheritors]
public abstract class ReagentEntityReaction
{
[ViewVariables]
[DataField("touch")]
public bool Touch { get; } = false;
[ViewVariables]
[DataField("injection")]
public bool Injection { get; } = false;
[ViewVariables]
[DataField("ingestion")]
public bool Ingestion { get; } = false;
2021-11-09 11:12:55 +01:00
public void React(ReactionMethod method, EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager)
{
switch (method)
{
case ReactionMethod.Touch:
if (!Touch)
return;
break;
case ReactionMethod.Injection:
if(!Injection)
return;
break;
case ReactionMethod.Ingestion:
if(!Ingestion)
return;
break;
default:
throw new ArgumentOutOfRangeException(nameof(method), method, null);
}
2021-11-09 11:12:55 +01:00
React(uid, reagent, volume, source, entityManager);
}
2021-11-09 11:12:55 +01:00
protected abstract void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager);
}
}