@@ -15,7 +15,7 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
public override string Name => "AreaEffectInception";
|
||||
|
||||
private const float ReactionDelay = 0.5f;
|
||||
private const float ReactionDelay = 1.5f;
|
||||
|
||||
private readonly HashSet<SolutionAreaEffectComponent> _group = new();
|
||||
|
||||
|
||||
36
Content.Server/Chemistry/ReagentEffects/DoAction.cs
Normal file
36
Content.Server/Chemistry/ReagentEffects/DoAction.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Actions.Prototypes;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Construction.Steps;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects;
|
||||
|
||||
/// <summary>
|
||||
/// Forces someone to do a certain action, if they have it.
|
||||
/// </summary>
|
||||
public class DoAction : ReagentEffect
|
||||
{
|
||||
[DataField("action", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<ActionPrototype>))]
|
||||
public string Action = default!;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out SharedActionsComponent? actions))
|
||||
{
|
||||
if (!IoCManager.Resolve<IPrototypeManager>().TryIndex<ActionPrototype>(Action, out var proto))
|
||||
return;
|
||||
|
||||
if (actions.IsGranted(proto.ActionType))
|
||||
{
|
||||
var attempt = new ActionAttempt(proto);
|
||||
attempt.DoInstantAction(args.EntityManager.GetEntity(args.SolutionEntity));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects
|
||||
@@ -18,9 +19,20 @@ namespace Content.Server.Chemistry.ReagentEffects
|
||||
[DataField("damage", required: true)]
|
||||
public DamageSpecifier Damage = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Should this effect scale the damage by the amount of chemical in the solution?
|
||||
/// Useful for touch reactions, like styptic powder or acid.
|
||||
/// </summary>
|
||||
[DataField("scaleByQuantity")]
|
||||
public bool ScaleByQuantity = false;
|
||||
|
||||
[DataField("ignoreResistances")]
|
||||
public bool IgnoreResistances = true;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage, true);
|
||||
var scale = ScaleByQuantity ? args.Quantity : FixedPoint2.New(1);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user