screaming and crying (#5447)

This commit is contained in:
mirrorcult
2021-11-22 01:40:14 -07:00
committed by GitHub
parent 1738b571ee
commit 0f2dda8275
4 changed files with 28 additions and 28 deletions

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.Components
public class FoamSolutionAreaEffectComponent : SolutionAreaEffectComponent public class FoamSolutionAreaEffectComponent : SolutionAreaEffectComponent
{ {
public override string Name => "FoamSolutionAreaEffect"; public override string Name => "FoamSolutionAreaEffect";
public new const string SolutionName = "foam"; public new const string SolutionName = "solutionArea";
[DataField("foamedMetalPrototype")] private string? _foamedMetalPrototype; [DataField("foamedMetalPrototype")] private string? _foamedMetalPrototype;

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Chemistry.Components
public class SmokeSolutionAreaEffectComponent : SolutionAreaEffectComponent public class SmokeSolutionAreaEffectComponent : SolutionAreaEffectComponent
{ {
public override string Name => "SmokeSolutionAreaEffect"; public override string Name => "SmokeSolutionAreaEffect";
public new const string SolutionName = "smoke"; public new const string SolutionName = "solutionArea";
protected override void UpdateVisuals() protected override void UpdateVisuals()
{ {

View File

@@ -41,16 +41,9 @@ namespace Content.Server.Chemistry.ReactionEffects
[DataField("diluteReagents")] private bool _diluteReagents; [DataField("diluteReagents")] private bool _diluteReagents;
/// <summary> /// <summary>
/// At what range should the reagents volume stay the same. If the effect range is higher than this then the reagents /// Used to calculate dilution. Increasing this makes the reagents more diluted.
/// will get diluted. If the effect range is lower than this then the reagents will get concentrated.
/// </summary> /// </summary>
[DataField("reagentDilutionStart")] private int _reagentDilutionStart = 4; [DataField("reagentDilutionFactor")] private float _reagentDilutionFactor = 1f;
/// <summary>
/// Used to calculate dilution. Increasing this makes the reagents get more diluted. This means that a lower range
/// will be needed to make the reagents volume get closer to zero.
/// </summary>
[DataField("reagentDilutionFactor")] private float _reagentDilutionFactor = 1;
/// <summary> /// <summary>
/// Used to calculate concentration. Reagents get linearly more concentrated as the range goes from /// Used to calculate concentration. Reagents get linearly more concentrated as the range goes from
@@ -105,20 +98,10 @@ namespace Content.Server.Chemistry.ReactionEffects
// The maximum value of solutionFraction is _reagentMaxConcentrationFactor, achieved when amount = 0 // The maximum value of solutionFraction is _reagentMaxConcentrationFactor, achieved when amount = 0
// The infimum of solutionFraction is 0, which is approached when amount tends to infinity // The infimum of solutionFraction is 0, which is approached when amount tends to infinity
// solutionFraction is equal to 1 only when amount equals _reagentDilutionStart // solutionFraction is equal to 1 only when amount equals _reagentDilutionStart
float solutionFraction; // Weird formulas here but basically when amount increases, solutionFraction gets closer to 0 in a reciprocal manner
if (amount >= _reagentDilutionStart) // _reagentDilutionFactor defines how fast solutionFraction gets closer to 0
{ float solutionFraction = 1 / (_reagentDilutionFactor*(amount) + 1);
// Weird formulas here but basically when amount increases, solutionFraction gets closer to 0 in a reciprocal manner splitSolution.RemoveSolution(splitSolution.TotalVolume * (1 - solutionFraction));
// _reagentDilutionFactor defines how fast solutionFraction gets closer to 0
solutionFraction = 1 / (_reagentDilutionFactor*(amount - _reagentDilutionStart) + 1);
}
else
{
// Here when amount decreases, solutionFraction gets closer to _reagentMaxConcentrationFactor in a linear manner
solutionFraction = amount * (1 - _reagentMaxConcentrationFactor) / _reagentDilutionStart +
_reagentMaxConcentrationFactor;
}
splitSolution.RemoveSolution(splitSolution.TotalVolume * solutionFraction);
} }
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity); var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);

View File

@@ -16,7 +16,7 @@
- type: SmokeSolutionAreaEffect - type: SmokeSolutionAreaEffect
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
smoke: solutionArea:
maxVol: 600 maxVol: 600
- type: entity - type: entity
@@ -43,7 +43,8 @@
anchored: true anchored: true
- type: Physics - type: Physics
fixtures: fixtures:
- shape: - hard: false
shape:
!type:PhysShapeAabb !type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4" bounds: "-0.4,-0.4,0.4,0.4"
layer: layer:
@@ -51,7 +52,7 @@
- type: FoamSolutionAreaEffect - type: FoamSolutionAreaEffect
- type: SolutionContainerManager - type: SolutionContainerManager
solutions: solutions:
foam: solutionArea:
maxVol: 600 maxVol: 600
- type: Slippery - type: Slippery
@@ -66,6 +67,14 @@
layers: layers:
- state: mfoam - state: mfoam
map: ["enum.FoamVisualLayers.Base"] map: ["enum.FoamVisualLayers.Base"]
- type: Physics
fixtures:
- hard: true
shape:
!type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4"
layer:
- MobImpassable
- type: Appearance - type: Appearance
visuals: visuals:
- type: FoamVisualizer - type: FoamVisualizer
@@ -85,6 +94,14 @@
layers: layers:
- state: mfoam - state: mfoam
map: ["enum.FoamVisualLayers.Base"] map: ["enum.FoamVisualLayers.Base"]
- type: Physics
fixtures:
- hard: true
shape:
!type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4"
layer:
- MobImpassable
- type: Appearance - type: Appearance
visuals: visuals:
- type: FoamVisualizer - type: FoamVisualizer