* Creates Content.Shared.Chemistry.Solutions Copies Solution class to new namespace Obsoletes old Solution class * Switches over to the Solutions.Solution Solution * Creates Content.Shared.Chemistry.Containers Copies relevant components/systems to the new namespace Obsoletes old versions * Switches over to the Containers.XYZ namespace * Creates SolutionSystem and obsoletes old SolutionContainerSystem methods * Start using SolutionSystem for Solution manipulation * EnumerateSolutions * Move TryGetMixableSolution * Move EnsureSolution to Server * Create Solution Entities * Stop using obsolete solution system methods * Fix prototype component tests * Add using ..Audio.Systems; back * Wrap solution container slots in ContainerSlots * Actually add the slot to the solution container map * Dirty SolutionContainerComponent when ensuring solutions * Revert namespace changes * Remerge SolutionSystem and SolutionContainerSystem * SolutionContainerManagerComponent refactor * Avoid wrapping necessary code in DebugTools.Assert as it is removed when compiling for release * Readd examine reagent sorting * Fix errors * Poke tests * Fix solution names not being applied * Fix WoolyComponent including statement * Fix merge skew * Fix compile errors * Make reactions use solntities * Reindent solution class namespace * Field attribute changes * AutoGenerateComponentState for SolutionContainerComponent * SolutionContainerComponent -> ContainedSolutionComponent * ref ReactionAttemptEvent * Denetwork preinit solutions * Misc 1 * Nullable TryGetSolution out vars * Cache associated solutions * Fix merge skew * Use explicit regions in SharedSolutionContainerSystem.Capabilities * Add debug assert * Use explicit regions in SharedSolutionContainerSystem.Relay + ref SolutionContainerChangedEvent * ContainedSolutionComponent.Name -> ContainedSolutionComponent.ContainerName * SolutionComponent doc comments * Implicit DataField names and property purge * ReagentEffect DataField names * Local variables for readability * Sort using statements + Entity<T> event handlers * Fix compile erros * Fix compile errors --------- Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
73 lines
2.6 KiB
C#
73 lines
2.6 KiB
C#
using Content.Server.Explosion.EntitySystems;
|
|
using Content.Shared.Chemistry.Reagent;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Explosion;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Content.Server.Chemistry.ReactionEffects
|
|
{
|
|
[DataDefinition]
|
|
public sealed partial class ExplosionReactionEffect : ReagentEffect
|
|
{
|
|
/// <summary>
|
|
/// The type of explosion. Determines damage types and tile break chance scaling.
|
|
/// </summary>
|
|
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdSerializer<ExplosionPrototype>))]
|
|
[JsonIgnore]
|
|
public string ExplosionType = default!;
|
|
|
|
/// <summary>
|
|
/// The max intensity the explosion can have at a given tile. Places an upper limit of damage and tile break
|
|
/// chance.
|
|
/// </summary>
|
|
[DataField]
|
|
[JsonIgnore]
|
|
public float MaxIntensity = 5;
|
|
|
|
/// <summary>
|
|
/// How quickly intensity drops off as you move away from the epicenter
|
|
/// </summary>
|
|
[DataField]
|
|
[JsonIgnore]
|
|
public float IntensitySlope = 1;
|
|
|
|
/// <summary>
|
|
/// The maximum total intensity that this chemical reaction can achieve. Basically here to prevent people
|
|
/// from creating a nuke by collecting enough potassium and water.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// A slope of 1 and MaxTotalIntensity of 100 corresponds to a radius of around 4.5 tiles.
|
|
/// </remarks>
|
|
[DataField]
|
|
[JsonIgnore]
|
|
public float MaxTotalIntensity = 100;
|
|
|
|
/// <summary>
|
|
/// The intensity of the explosion per unit reaction.
|
|
/// </summary>
|
|
[DataField]
|
|
[JsonIgnore]
|
|
public float IntensityPerUnit = 1;
|
|
|
|
public override bool ShouldLog => true;
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
=> Loc.GetString("reagent-effect-guidebook-explosion-reaction-effect", ("chance", Probability));
|
|
public override LogImpact LogImpact => LogImpact.High;
|
|
|
|
public override void Effect(ReagentEffectArgs args)
|
|
{
|
|
var intensity = MathF.Min((float) args.Quantity * IntensityPerUnit, MaxTotalIntensity);
|
|
|
|
EntitySystem.Get<ExplosionSystem>().QueueExplosion(
|
|
args.SolutionEntity,
|
|
ExplosionType,
|
|
intensity,
|
|
IntensitySlope,
|
|
MaxIntensity);
|
|
}
|
|
}
|
|
}
|