@@ -66,27 +66,14 @@ public sealed partial class ReleaseGasOnTriggerSystem : SharedReleaseGasOnTrigge
|
||||
RemCompDeferred<ReleaseGasOnTriggerComponent>(uid);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (comp.ExponentialRise)
|
||||
UpdateExponentialRise(comp, comp.RemoveFraction);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the RemoveFraction for exponential rise.
|
||||
/// </summary>
|
||||
/// <remarks>See https://www.desmos.com/calculator/fx9gfrhoim</remarks>
|
||||
private static void UpdateExponentialRise(ReleaseGasOnTriggerComponent comp, float baseFraction)
|
||||
{
|
||||
comp.TimesReleased++;
|
||||
comp.RemoveFraction = 1f - MathF.Pow(1f - baseFraction, comp.TimesReleased);
|
||||
}
|
||||
|
||||
private void UpdateAppearance(Entity<AppearanceComponent?> entity, bool state)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp, false))
|
||||
return;
|
||||
|
||||
_appearance.SetData(entity, ReleaseGasOnTriggerComponent.ReleaseGasOnTriggerVisuals.Key, state);
|
||||
_appearance.SetData(entity, ReleaseGasOnTriggerVisuals.Key, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,6 @@ namespace Content.Shared.Explosion.Components.OnTrigger;
|
||||
[Access(typeof(SharedReleaseGasOnTriggerSystem))]
|
||||
public sealed partial class ReleaseGasOnTriggerComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents visual states for whatever visuals that need to be applied
|
||||
/// on state changes.
|
||||
/// </summary>
|
||||
[Serializable] [NetSerializable]
|
||||
public enum ReleaseGasOnTriggerVisuals : byte
|
||||
{
|
||||
Key,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether this grenade is active and releasing gas.
|
||||
/// Set to true when triggered, which starts gas release.
|
||||
@@ -37,12 +27,6 @@ public sealed partial class ReleaseGasOnTriggerComponent : Component
|
||||
[DataField]
|
||||
public GasMixture Air;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the gas will be released in an exponential manner.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool ExponentialRise;
|
||||
|
||||
/// <summary>
|
||||
/// Time at which the next release will occur.
|
||||
/// This is automatically set when the grenade activates.
|
||||
@@ -53,7 +37,7 @@ public sealed partial class ReleaseGasOnTriggerComponent : Component
|
||||
|
||||
/// <summary>
|
||||
/// The cap at which this grenade can fill the exposed atmosphere to.
|
||||
/// The grenade automatically deletes itself when the pressure is reached.
|
||||
/// This component automatically removes itself when the pressure limit is reached.
|
||||
/// </summary>
|
||||
/// <example>If set to 101.325, the grenade will only fill the exposed
|
||||
/// atmosphere up to 101.325 kPa.</example>
|
||||
@@ -83,11 +67,14 @@ public sealed partial class ReleaseGasOnTriggerComponent : Component
|
||||
/// <remarks>Set when the grenade is activated.</remarks>
|
||||
[DataField(readOnly: true)]
|
||||
public float StartingTotalMoles;
|
||||
|
||||
/// <summary>
|
||||
/// Stores the number of times the grenade has been released,
|
||||
/// for exponential rise calculations.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public int TimesReleased;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents visual states for whatever visuals that need to be applied
|
||||
/// on state changes.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public enum ReleaseGasOnTriggerVisuals : byte
|
||||
{
|
||||
Key,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user