@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,3 +3,6 @@
|
||||
|
||||
- type: reactiveGroup
|
||||
id: Extinguish
|
||||
|
||||
- type: reactiveGroup
|
||||
id: Acidic
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
groups:
|
||||
Flammable: [Touch]
|
||||
Extinguish: [Touch]
|
||||
Acidic: [Touch, Ingestion]
|
||||
- type: UtilityAI
|
||||
behaviorSets:
|
||||
# - Clothing
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
groups:
|
||||
Flammable: [ Touch ]
|
||||
Extinguish: [ Touch ]
|
||||
Acidic: [Touch, Ingestion]
|
||||
reactions:
|
||||
- reagents: [Water, SpaceCleaner]
|
||||
methods: [Touch]
|
||||
|
||||
@@ -32,7 +32,19 @@
|
||||
amount: -4
|
||||
- !type:PlantAdjustHealth
|
||||
amount: -8
|
||||
# TODO MIRROR acid! hurt people on contact
|
||||
reactiveEffects:
|
||||
Acidic:
|
||||
methods: [ Touch ]
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
scaleByQuantity: true
|
||||
ignoreResistances: false
|
||||
damage:
|
||||
groups:
|
||||
Caustic: 0.5
|
||||
- !type:DoAction
|
||||
probability: 0.3
|
||||
action: HumanScream
|
||||
metabolisms:
|
||||
Poison:
|
||||
effects:
|
||||
@@ -53,7 +65,19 @@
|
||||
color: "#5050ff"
|
||||
boilingPoint: 165
|
||||
meltingPoint: -87
|
||||
# TODO MIRROR acid! hurt people on contact
|
||||
reactiveEffects:
|
||||
Acidic:
|
||||
methods: [ Touch ]
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
scaleByQuantity: true
|
||||
ignoreResistances: false
|
||||
damage:
|
||||
groups:
|
||||
Caustic: 0.3
|
||||
- !type:DoAction
|
||||
probability: 0.2
|
||||
action: HumanScream
|
||||
metabolisms:
|
||||
Poison:
|
||||
effects:
|
||||
@@ -81,6 +105,19 @@
|
||||
amount: -2
|
||||
- !type:PlantAdjustHealth
|
||||
amount: -5
|
||||
reactiveEffects:
|
||||
Acidic:
|
||||
methods: [ Touch ]
|
||||
effects:
|
||||
- !type:HealthChange
|
||||
scaleByQuantity: true
|
||||
ignoreResistances: false
|
||||
damage:
|
||||
groups:
|
||||
Caustic: 0.1
|
||||
- !type:DoAction
|
||||
probability: 0.1
|
||||
action: HumanScream
|
||||
metabolisms:
|
||||
Poison:
|
||||
effects:
|
||||
|
||||
Reference in New Issue
Block a user