2021-03-26 12:02:41 +01:00
|
|
|
using System;
|
2021-11-03 16:48:03 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
2021-03-26 12:02:41 +01:00
|
|
|
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
|
2021-03-26 12:02:41 +01:00
|
|
|
{
|
|
|
|
|
public enum ReactionMethod
|
|
|
|
|
{
|
|
|
|
|
Touch,
|
|
|
|
|
Injection,
|
|
|
|
|
Ingestion,
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-31 01:59:18 -07:00
|
|
|
[ImplicitDataDefinitionForInheritors]
|
2021-03-26 12:02:41 +01:00
|
|
|
public abstract class ReagentEntityReaction
|
|
|
|
|
{
|
|
|
|
|
[ViewVariables]
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("touch")]
|
2021-03-26 12:02:41 +01:00
|
|
|
public bool Touch { get; } = false;
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("injection")]
|
2021-03-26 12:02:41 +01:00
|
|
|
public bool Injection { get; } = false;
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("ingestion")]
|
2021-03-26 12:02:41 +01:00
|
|
|
public bool Ingestion { get; } = false;
|
|
|
|
|
|
2021-11-03 16:48:03 -07:00
|
|
|
public void React(ReactionMethod method, IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source)
|
2021-03-26 12:02:41 +01:00
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
React(entity, reagent, volume, source);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-03 16:48:03 -07:00
|
|
|
protected abstract void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source);
|
2021-03-26 12:02:41 +01:00
|
|
|
}
|
|
|
|
|
}
|