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 override string Name => "FoamSolutionAreaEffect";
public new const string SolutionName = "foam";
public new const string SolutionName = "solutionArea";
[DataField("foamedMetalPrototype")] private string? _foamedMetalPrototype;

View File

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

View File

@@ -41,16 +41,9 @@ namespace Content.Server.Chemistry.ReactionEffects
[DataField("diluteReagents")] private bool _diluteReagents;
/// <summary>
/// At what range should the reagents volume stay the same. If the effect range is higher than this then the reagents
/// will get diluted. If the effect range is lower than this then the reagents will get concentrated.
/// Used to calculate dilution. Increasing this makes the reagents more diluted.
/// </summary>
[DataField("reagentDilutionStart")] private int _reagentDilutionStart = 4;
/// <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;
[DataField("reagentDilutionFactor")] private float _reagentDilutionFactor = 1f;
/// <summary>
/// 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 infimum of solutionFraction is 0, which is approached when amount tends to infinity
// solutionFraction is equal to 1 only when amount equals _reagentDilutionStart
float solutionFraction;
if (amount >= _reagentDilutionStart)
{
// Weird formulas here but basically when amount increases, solutionFraction gets closer to 0 in a reciprocal manner
// _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);
float solutionFraction = 1 / (_reagentDilutionFactor*(amount) + 1);
splitSolution.RemoveSolution(splitSolution.TotalVolume * (1 - solutionFraction));
}
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);

View File

@@ -16,7 +16,7 @@
- type: SmokeSolutionAreaEffect
- type: SolutionContainerManager
solutions:
smoke:
solutionArea:
maxVol: 600
- type: entity
@@ -43,7 +43,8 @@
anchored: true
- type: Physics
fixtures:
- shape:
- hard: false
shape:
!type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4"
layer:
@@ -51,7 +52,7 @@
- type: FoamSolutionAreaEffect
- type: SolutionContainerManager
solutions:
foam:
solutionArea:
maxVol: 600
- type: Slippery
@@ -66,6 +67,14 @@
layers:
- state: mfoam
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
visuals:
- type: FoamVisualizer
@@ -85,6 +94,14 @@
layers:
- state: mfoam
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
visuals:
- type: FoamVisualizer