@@ -15,7 +15,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
{
|
{
|
||||||
public override string Name => "AreaEffectInception";
|
public override string Name => "AreaEffectInception";
|
||||||
|
|
||||||
private const float ReactionDelay = 0.5f;
|
private const float ReactionDelay = 1.5f;
|
||||||
|
|
||||||
private readonly HashSet<SolutionAreaEffectComponent> _group = new();
|
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.GameObjects;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReagentEffects
|
namespace Content.Server.Chemistry.ReagentEffects
|
||||||
@@ -18,9 +19,20 @@ namespace Content.Server.Chemistry.ReagentEffects
|
|||||||
[DataField("damage", required: true)]
|
[DataField("damage", required: true)]
|
||||||
public DamageSpecifier Damage = default!;
|
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)
|
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
|
- type: reactiveGroup
|
||||||
id: Extinguish
|
id: Extinguish
|
||||||
|
|
||||||
|
- type: reactiveGroup
|
||||||
|
id: Acidic
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
groups:
|
groups:
|
||||||
Flammable: [Touch]
|
Flammable: [Touch]
|
||||||
Extinguish: [Touch]
|
Extinguish: [Touch]
|
||||||
|
Acidic: [Touch, Ingestion]
|
||||||
- type: UtilityAI
|
- type: UtilityAI
|
||||||
behaviorSets:
|
behaviorSets:
|
||||||
# - Clothing
|
# - Clothing
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
groups:
|
groups:
|
||||||
Flammable: [ Touch ]
|
Flammable: [ Touch ]
|
||||||
Extinguish: [ Touch ]
|
Extinguish: [ Touch ]
|
||||||
|
Acidic: [Touch, Ingestion]
|
||||||
reactions:
|
reactions:
|
||||||
- reagents: [Water, SpaceCleaner]
|
- reagents: [Water, SpaceCleaner]
|
||||||
methods: [Touch]
|
methods: [Touch]
|
||||||
|
|||||||
@@ -32,7 +32,19 @@
|
|||||||
amount: -4
|
amount: -4
|
||||||
- !type:PlantAdjustHealth
|
- !type:PlantAdjustHealth
|
||||||
amount: -8
|
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:
|
metabolisms:
|
||||||
Poison:
|
Poison:
|
||||||
effects:
|
effects:
|
||||||
@@ -53,7 +65,19 @@
|
|||||||
color: "#5050ff"
|
color: "#5050ff"
|
||||||
boilingPoint: 165
|
boilingPoint: 165
|
||||||
meltingPoint: -87
|
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:
|
metabolisms:
|
||||||
Poison:
|
Poison:
|
||||||
effects:
|
effects:
|
||||||
@@ -81,6 +105,19 @@
|
|||||||
amount: -2
|
amount: -2
|
||||||
- !type:PlantAdjustHealth
|
- !type:PlantAdjustHealth
|
||||||
amount: -5
|
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:
|
metabolisms:
|
||||||
Poison:
|
Poison:
|
||||||
effects:
|
effects:
|
||||||
|
|||||||
Reference in New Issue
Block a user