The Pyro Update (#5575)
This commit is contained in:
@@ -16,10 +16,20 @@ namespace Content.IntegrationTests.Tests.Chemistry
|
|||||||
[TestOf(typeof(ReactionPrototype))]
|
[TestOf(typeof(ReactionPrototype))]
|
||||||
public class TryAllReactionsTest : ContentIntegrationTest
|
public class TryAllReactionsTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
private const string Prototypes = @"
|
||||||
|
- type: entity
|
||||||
|
id: TestSolutionContainer
|
||||||
|
components:
|
||||||
|
- type: SolutionContainerManager
|
||||||
|
solutions:
|
||||||
|
beaker:
|
||||||
|
maxVol: 50";
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TryAllTest()
|
public async Task TryAllTest()
|
||||||
{
|
{
|
||||||
var server = StartServer();
|
var options = new ServerContentIntegrationOption{ExtraPrototypes = Prototypes};
|
||||||
|
var server = StartServer(options);
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
@@ -38,7 +48,7 @@ namespace Content.IntegrationTests.Tests.Chemistry
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
beaker = entityManager.SpawnEntity("BluespaceBeaker", coordinates);
|
beaker = entityManager.SpawnEntity("TestSolutionContainer", coordinates);
|
||||||
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
||||||
.TryGetSolution(beaker.Uid, "beaker", out component));
|
.TryGetSolution(beaker.Uid, "beaker", out component));
|
||||||
foreach (var (id, reactant) in reactionPrototype.Reactants)
|
foreach (var (id, reactant) in reactionPrototype.Reactants)
|
||||||
|
|||||||
36
Content.Server/Chemistry/ReagentEffects/CreateGas.cs
Normal file
36
Content.Server/Chemistry/ReagentEffects/CreateGas.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
|
using Content.Shared.Atmos;
|
||||||
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.Database;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Server.Chemistry.ReagentEffects;
|
||||||
|
|
||||||
|
public class CreateGas : ReagentEffect
|
||||||
|
{
|
||||||
|
[DataField("gas", required: true)]
|
||||||
|
public Gas Gas = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For each unit consumed, how many moles of gas should be created?
|
||||||
|
/// </summary>
|
||||||
|
[DataField("multiplier")]
|
||||||
|
public float Multiplier = 3f;
|
||||||
|
|
||||||
|
public override bool ShouldLog => true;
|
||||||
|
public override LogImpact LogImpact => LogImpact.High;
|
||||||
|
|
||||||
|
public override void Effect(ReagentEffectArgs args)
|
||||||
|
{
|
||||||
|
var atmosSys = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
|
var xform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||||
|
var tileMix = atmosSys.GetTileMixture(xform.Coordinates);
|
||||||
|
|
||||||
|
if (tileMix != null)
|
||||||
|
{
|
||||||
|
tileMix.AdjustMoles(Gas, args.Quantity.Float() * Multiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,9 @@ namespace Content.Server.Chemistry.ReagentEffects
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class FlammableReaction : ReagentEffect
|
public class FlammableReaction : ReagentEffect
|
||||||
{
|
{
|
||||||
|
[DataField("multiplier")]
|
||||||
|
public float Multiplier = 0.05f;
|
||||||
|
|
||||||
public override bool ShouldLog => true;
|
public override bool ShouldLog => true;
|
||||||
public override LogImpact LogImpact => LogImpact.Medium;
|
public override LogImpact LogImpact => LogImpact.Medium;
|
||||||
|
|
||||||
@@ -23,7 +26,7 @@ namespace Content.Server.Chemistry.ReagentEffects
|
|||||||
{
|
{
|
||||||
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return;
|
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out FlammableComponent? flammable)) return;
|
||||||
|
|
||||||
EntitySystem.Get<FlammableSystem>().AdjustFireStacks(args.SolutionEntity, args.Quantity.Float() / 5f, flammable);
|
EntitySystem.Get<FlammableSystem>().AdjustFireStacks(args.SolutionEntity, args.Quantity.Float() * Multiplier, flammable);
|
||||||
args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity);
|
args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
Content.Server/Chemistry/ReagentEffects/Ignite.cs
Normal file
21
Content.Server/Chemistry/ReagentEffects/Ignite.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Content.Server.Atmos.EntitySystems;
|
||||||
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.Database;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.Chemistry.ReagentEffects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ignites a mob.
|
||||||
|
/// </summary>
|
||||||
|
public class Ignite : ReagentEffect
|
||||||
|
{
|
||||||
|
public override bool ShouldLog => true;
|
||||||
|
public override LogImpact LogImpact => LogImpact.Medium;
|
||||||
|
|
||||||
|
public override void Effect(ReagentEffectArgs args)
|
||||||
|
{
|
||||||
|
var flamSys = EntitySystem.Get<FlammableSystem>();
|
||||||
|
flamSys.Ignite(args.SolutionEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Content.Server/Chemistry/TileReactions/PryTileReaction.cs
Normal file
20
Content.Server/Chemistry/TileReactions/PryTileReaction.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Shared.Chemistry.Reaction;
|
||||||
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
|
using Content.Shared.Maps;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Server.Chemistry.TileReactions;
|
||||||
|
|
||||||
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
|
public class PryTileReaction : ITileReaction
|
||||||
|
{
|
||||||
|
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||||
|
{
|
||||||
|
tile.PryTile();
|
||||||
|
return reactVolume;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ using Content.Shared.FixedPoint;
|
|||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Shared.Chemistry.Reaction
|
namespace Content.Shared.Chemistry.Reaction
|
||||||
@@ -26,12 +27,14 @@ namespace Content.Shared.Chemistry.Reaction
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reactants required for the reaction to occur.
|
/// Reactants required for the reaction to occur.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("reactants")] public Dictionary<string, ReactantPrototype> Reactants = new();
|
[DataField("reactants", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<ReactantPrototype, ReagentPrototype>))]
|
||||||
|
public Dictionary<string, ReactantPrototype> Reactants = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reagents created when the reaction occurs.
|
/// Reagents created when the reaction occurs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("products")] public Dictionary<string, FixedPoint2> Products = new();
|
[DataField("products", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<FixedPoint2, ReagentPrototype>))]
|
||||||
|
public Dictionary<string, FixedPoint2> Products = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Effects to be triggered when the reaction occurs.
|
/// Effects to be triggered when the reaction occurs.
|
||||||
|
|||||||
3
Resources/Locale/en-US/reagents/clf3.ftl
Normal file
3
Resources/Locale/en-US/reagents/clf3.ftl
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
clf3-it-burns = It burns like hell!!
|
||||||
|
clf3-get-away = You need to get away now!
|
||||||
|
clf3-explosion = The mixture fireballs outwards!
|
||||||
1
Resources/Locale/en-US/reagents/phlogiston.ftl
Normal file
1
Resources/Locale/en-US/reagents/phlogiston.ftl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
phlogiston-plasma-created = The mixture bubbles, and plasma rises from it!
|
||||||
@@ -5,6 +5,11 @@
|
|||||||
methods: [ Touch ]
|
methods: [ Touch ]
|
||||||
effects:
|
effects:
|
||||||
- !type:FlammableReaction
|
- !type:FlammableReaction
|
||||||
|
plantMetabolism:
|
||||||
|
- !type:PlantAdjustWeeds
|
||||||
|
amount: -2
|
||||||
|
- !type:PlantAdjustHealth
|
||||||
|
amount: -2
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: Thermite
|
id: Thermite
|
||||||
@@ -26,6 +31,93 @@
|
|||||||
types:
|
types:
|
||||||
Heat: 2
|
Heat: 2
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: Napalm
|
||||||
|
name: napalm
|
||||||
|
parent: BasePyrotechnic
|
||||||
|
desc: It's just a little flammable.
|
||||||
|
physicalDesc: soapy
|
||||||
|
color: "#FA00AF"
|
||||||
|
tileReactions:
|
||||||
|
- !type:FlammableTileReaction
|
||||||
|
temperatureMultiplier: 5
|
||||||
|
reactiveEffects:
|
||||||
|
Flammable:
|
||||||
|
methods: [ Touch ]
|
||||||
|
effects:
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.4
|
||||||
|
metabolisms:
|
||||||
|
Poison:
|
||||||
|
effects:
|
||||||
|
- !type:HealthChange
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Heat: 1
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.4
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: Phlogiston
|
||||||
|
name: phlogiston
|
||||||
|
parent: BasePyrotechnic
|
||||||
|
desc: Catches you on fire and makes you ignite.
|
||||||
|
physicalDesc: burning
|
||||||
|
color: "#D4872A"
|
||||||
|
metabolisms:
|
||||||
|
Poison:
|
||||||
|
effects:
|
||||||
|
- !type:HealthChange
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Heat: 3
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.1
|
||||||
|
- !type:AdjustTemperature
|
||||||
|
amount: 6000
|
||||||
|
reactiveEffects:
|
||||||
|
Flammable:
|
||||||
|
methods: [ Touch ]
|
||||||
|
effects:
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.2
|
||||||
|
- !type:Ignite
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: ChlorineTrifluoride
|
||||||
|
name: CLF3
|
||||||
|
parent: BasePyrotechnic
|
||||||
|
desc: You really, REALLY don't want to get this shit anywhere near you.
|
||||||
|
physicalDesc: blazing
|
||||||
|
color: "#FFC8C8"
|
||||||
|
tileReactions:
|
||||||
|
- !type:PryTileReaction
|
||||||
|
metabolisms:
|
||||||
|
Poison:
|
||||||
|
effects:
|
||||||
|
- !type:HealthChange
|
||||||
|
damage:
|
||||||
|
types:
|
||||||
|
Heat: 1
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.2
|
||||||
|
- !type:AdjustTemperature
|
||||||
|
amount: 6000
|
||||||
|
reactiveEffects:
|
||||||
|
Flammable:
|
||||||
|
methods: [ Touch ]
|
||||||
|
effects:
|
||||||
|
- !type:FlammableReaction
|
||||||
|
multiplier: 0.3
|
||||||
|
- !type:Ignite
|
||||||
|
- !type:DoAction
|
||||||
|
probability: 0.2
|
||||||
|
action: HumanScream
|
||||||
|
- !type:PopupMessage
|
||||||
|
messages: [ "clf3-it-burns", "clf3-get-away" ]
|
||||||
|
probability: 0.3
|
||||||
|
type: Local
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: FoamingAgent
|
id: FoamingAgent
|
||||||
name: foaming agent
|
name: foaming agent
|
||||||
|
|||||||
50
Resources/Prototypes/Recipes/Reactions/pyrotechnic.yml
Normal file
50
Resources/Prototypes/Recipes/Reactions/pyrotechnic.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
- type: reaction
|
||||||
|
id: Napalm
|
||||||
|
reactants:
|
||||||
|
Oil:
|
||||||
|
amount: 1
|
||||||
|
WeldingFuel:
|
||||||
|
amount: 1
|
||||||
|
Ethanol:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
Napalm: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: Phlogiston
|
||||||
|
reactants:
|
||||||
|
Phosphorus:
|
||||||
|
amount: 1
|
||||||
|
SulfuricAcid:
|
||||||
|
amount: 1
|
||||||
|
Plasma:
|
||||||
|
amount: 1
|
||||||
|
effects:
|
||||||
|
- !type:CreateGas
|
||||||
|
gas: Plasma
|
||||||
|
- !type:PopupMessage
|
||||||
|
messages: [ "phlogiston-plasma-created" ]
|
||||||
|
type: Pvs
|
||||||
|
products:
|
||||||
|
Phlogiston: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: ChlorineTrifluoride
|
||||||
|
reactants:
|
||||||
|
Chlorine:
|
||||||
|
amount: 1
|
||||||
|
Fluorine:
|
||||||
|
amount: 3
|
||||||
|
effects:
|
||||||
|
# TODO electro's pretty explosions PR make this big and firey!!
|
||||||
|
# TODO solution temperature!!
|
||||||
|
- !type:ExplosionReactionEffect
|
||||||
|
devastationRange: 0
|
||||||
|
heavyImpactRange: 0
|
||||||
|
lightImpactRange: 2
|
||||||
|
scaled: false
|
||||||
|
- !type:PopupMessage
|
||||||
|
messages: [ "clf3-explosion" ]
|
||||||
|
type: Pvs
|
||||||
|
products:
|
||||||
|
ChlorineTrifluoride: 4
|
||||||
Reference in New Issue
Block a user