forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Implement some field-level deltas (space-wizards#28242)"
This reverts commit ea0359e.
- Loading branch information
1 parent
c1b272a
commit db0cd2c
Showing
129 changed files
with
1,942 additions
and
2,245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Content.Server.Fluids.EntitySystems; | ||
using Content.Shared.Audio; | ||
using Content.Shared.Chemistry.Reagent; | ||
using Content.Shared.Coordinates.Helpers; | ||
using Content.Shared.Database; | ||
using Content.Shared.FixedPoint; | ||
using Content.Shared.Maps; | ||
using JetBrains.Annotations; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
|
||
namespace Content.Server.Chemistry.ReactionEffects | ||
{ | ||
/// <summary> | ||
/// Basically smoke and foam reactions. | ||
/// </summary> | ||
[UsedImplicitly] | ||
[DataDefinition] | ||
public sealed partial class AreaReactionEffect : ReagentEffect | ||
{ | ||
/// <summary> | ||
/// How many seconds will the effect stay, counting after fully spreading. | ||
/// </summary> | ||
[DataField("duration")] private float _duration = 10; | ||
|
||
/// <summary> | ||
/// How many units of reaction for 1 smoke entity. | ||
/// </summary> | ||
[DataField] public FixedPoint2 OverflowThreshold = FixedPoint2.New(2.5); | ||
|
||
/// <summary> | ||
/// The entity prototype that will be spawned as the effect. | ||
/// </summary> | ||
[DataField("prototypeId", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))] | ||
private string _prototypeId = default!; | ||
|
||
/// <summary> | ||
/// Sound that will get played when this reaction effect occurs. | ||
/// </summary> | ||
[DataField("sound", required: true)] private SoundSpecifier _sound = default!; | ||
|
||
public override bool ShouldLog => true; | ||
|
||
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | ||
=> Loc.GetString("reagent-effect-guidebook-missing"); | ||
|
||
public override LogImpact LogImpact => LogImpact.High; | ||
|
||
public override void Effect(ReagentEffectArgs args) | ||
{ | ||
if (args.Source == null) | ||
return; | ||
|
||
var spreadAmount = (int) Math.Max(0, Math.Ceiling((args.Quantity / OverflowThreshold).Float())); | ||
var splitSolution = args.Source.SplitSolution(args.Source.Volume); | ||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity); | ||
var mapManager = IoCManager.Resolve<IMapManager>(); | ||
var mapSys = args.EntityManager.System<MapSystem>(); | ||
var sys = args.EntityManager.System<TransformSystem>(); | ||
var mapCoords = sys.GetMapCoordinates(args.SolutionEntity, xform: transform); | ||
|
||
if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) || | ||
!mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) || | ||
tileRef.Tile.IsSpace()) | ||
{ | ||
return; | ||
} | ||
|
||
var coords = mapSys.MapToGrid(gridUid, mapCoords); | ||
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid()); | ||
|
||
var smoke = args.EntityManager.System<SmokeSystem>(); | ||
smoke.StartSmoke(ent, splitSolution, _duration, spreadAmount); | ||
|
||
var audio = args.EntityManager.System<SharedAudioSystem>(); | ||
audio.PlayPvs(_sound, args.SolutionEntity, AudioHelpers.WithVariation(0.125f)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
Content.Server/Chemistry/ReactionEffects/ExplosionReactionEffect.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
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); | ||
} | ||
} | ||
} |
Oops, something went wrong.