Severely nerf fires and severely buff fire protection (#5396)
* Make fires do less damage * Severely nerf fires and severely buff temperature protection * fuck it, i'll nerf it so hard and we can buff it later if we decide * new scaling func * fix * unused * reviews + balance metabolism heat + reduce atmos air temp transfer efficiency * little more balance * just a wee bit more * slight adjustment
This commit is contained in:
@@ -93,6 +93,7 @@ namespace Content.Client.Entry
|
|||||||
"TilePrying",
|
"TilePrying",
|
||||||
"RandomSpriteColor",
|
"RandomSpriteColor",
|
||||||
"ConditionalSpawner",
|
"ConditionalSpawner",
|
||||||
|
"TemperatureProtection",
|
||||||
"DamageOnToolInteract",
|
"DamageOnToolInteract",
|
||||||
"ExaminableBattery",
|
"ExaminableBattery",
|
||||||
"PottedPlantHide",
|
"PottedPlantHide",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -19,6 +20,6 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
[DataField("maxDamage")]
|
[DataField("maxDamage")]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int MaxDamage = 200;
|
public FixedPoint2 MaxDamage = 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,5 @@ namespace Content.Server.Atmos.Components
|
|||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("canResistFire")]
|
[DataField("canResistFire")]
|
||||||
public bool CanResistFire { get; private set; } = false;
|
public bool CanResistFire { get; private set; } = false;
|
||||||
|
|
||||||
[DataField("damage", required: true)]
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public DamageSpecifier Damage = default!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using Content.Shared.FixedPoint;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
namespace Content.Server.Atmos.Components;
|
||||||
|
|
||||||
|
[RegisterComponent]
|
||||||
|
public class TemperatureProtectionComponent : Component
|
||||||
|
{
|
||||||
|
public override string Name => "TemperatureProtection";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How much to multiply temperature deltas by.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("coefficient")]
|
||||||
|
public float Coefficient = 1.0f;
|
||||||
|
}
|
||||||
@@ -123,7 +123,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if(pressure < Atmospherics.WarningHighPressure)
|
if(pressure < Atmospherics.WarningHighPressure)
|
||||||
goto default;
|
goto default;
|
||||||
|
|
||||||
var damageScale = (int) MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
|
var damageScale = MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
|
||||||
|
|
||||||
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
||||||
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true);
|
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true);
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ using System;
|
|||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
using Content.Server.Stunnable;
|
using Content.Server.Stunnable;
|
||||||
using Content.Server.Stunnable.Components;
|
|
||||||
using Content.Server.Temperature.Components;
|
|
||||||
using Content.Server.Temperature.Systems;
|
using Content.Server.Temperature.Systems;
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
@@ -11,7 +9,6 @@ using Content.Shared.Atmos;
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Stunnable;
|
|
||||||
using Content.Shared.Temperature;
|
using Content.Shared.Temperature;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -25,7 +22,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
internal sealed class FlammableSystem : EntitySystem
|
internal sealed class FlammableSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||||
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
|
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
|
||||||
@@ -209,11 +205,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
if (flammable.FireStacks > 0)
|
if (flammable.FireStacks > 0)
|
||||||
{
|
{
|
||||||
_temperatureSystem.ReceiveHeat(uid, 200 * flammable.FireStacks);
|
_temperatureSystem.ChangeHeat(uid, 80000 * flammable.FireStacks);
|
||||||
// TODO ATMOS Fire resistance from armor
|
|
||||||
var damageScale = Math.Min((int) (flammable.FireStacks * 2.5f), 10);
|
|
||||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * damageScale);
|
|
||||||
|
|
||||||
AdjustFireStacks(uid, -0.1f * (flammable.Resisting ? 10f : 1f), flammable);
|
AdjustFireStacks(uid, -0.1f * (flammable.Resisting ? 10f : 1f), flammable);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -240,25 +240,25 @@ namespace Content.Server.Body.Components
|
|||||||
{
|
{
|
||||||
var temperatureSystem = EntitySystem.Get<TemperatureSystem>();
|
var temperatureSystem = EntitySystem.Get<TemperatureSystem>();
|
||||||
if (!Owner.TryGetComponent(out TemperatureComponent? temperatureComponent)) return;
|
if (!Owner.TryGetComponent(out TemperatureComponent? temperatureComponent)) return;
|
||||||
temperatureSystem.ReceiveHeat(Owner.Uid, MetabolismHeat, temperatureComponent);
|
|
||||||
temperatureSystem.RemoveHeat(Owner.Uid, RadiatedHeat, temperatureComponent);
|
|
||||||
|
|
||||||
|
float totalMetabolismTempChange = MetabolismHeat - RadiatedHeat;
|
||||||
// implicit heat regulation
|
// implicit heat regulation
|
||||||
var tempDiff = Math.Abs(temperatureComponent.CurrentTemperature - NormalBodyTemperature);
|
var tempDiff = Math.Abs(temperatureComponent.CurrentTemperature - NormalBodyTemperature);
|
||||||
var targetHeat = tempDiff * temperatureComponent.HeatCapacity;
|
var targetHeat = tempDiff * temperatureComponent.HeatCapacity;
|
||||||
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
|
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
|
||||||
{
|
{
|
||||||
temperatureSystem.RemoveHeat(Owner.Uid, Math.Min(targetHeat, ImplicitHeatRegulation), temperatureComponent);
|
totalMetabolismTempChange -= Math.Min(targetHeat, ImplicitHeatRegulation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temperatureSystem.ReceiveHeat(Owner.Uid, Math.Min(targetHeat, ImplicitHeatRegulation), temperatureComponent);
|
totalMetabolismTempChange += Math.Min(targetHeat, ImplicitHeatRegulation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recalc difference and target heat
|
// recalc difference and target heat
|
||||||
tempDiff = Math.Abs(temperatureComponent.CurrentTemperature - NormalBodyTemperature);
|
tempDiff = Math.Abs(temperatureComponent.CurrentTemperature - NormalBodyTemperature);
|
||||||
targetHeat = tempDiff * temperatureComponent.HeatCapacity;
|
targetHeat = tempDiff * temperatureComponent.HeatCapacity;
|
||||||
|
|
||||||
|
temperatureSystem.ChangeHeat(Owner.Uid, totalMetabolismTempChange, true, temperatureComponent);
|
||||||
|
|
||||||
// if body temperature is not within comfortable, thermal regulation
|
// if body temperature is not within comfortable, thermal regulation
|
||||||
// processes starts
|
// processes starts
|
||||||
if (tempDiff < ThermalRegulationTemperatureThreshold)
|
if (tempDiff < ThermalRegulationTemperatureThreshold)
|
||||||
@@ -273,7 +273,6 @@ namespace Content.Server.Body.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||||
|
|
||||||
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
|
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
|
||||||
@@ -288,7 +287,7 @@ namespace Content.Server.Body.Components
|
|||||||
// creadth: sweating does not help in airless environment
|
// creadth: sweating does not help in airless environment
|
||||||
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates) is not {})
|
if (EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates) is not {})
|
||||||
{
|
{
|
||||||
temperatureSystem.RemoveHeat(OwnerUid, Math.Min(targetHeat, SweatHeatRegulation), temperatureComponent);
|
temperatureSystem.ChangeHeat(OwnerUid, -Math.Min(targetHeat, SweatHeatRegulation), true, temperatureComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -300,7 +299,7 @@ namespace Content.Server.Body.Components
|
|||||||
_isShivering = true;
|
_isShivering = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
temperatureSystem.ReceiveHeat(OwnerUid, Math.Min(targetHeat, ShiveringHeatRegulation), temperatureComponent);
|
temperatureSystem.ChangeHeat(OwnerUid, Math.Min(targetHeat, ShiveringHeatRegulation), true, temperatureComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
using Content.Server.Inventory.Components;
|
using Content.Server.Inventory.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
|
using Content.Server.Temperature.Systems;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Slippery;
|
using Content.Shared.Slippery;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
@@ -25,6 +26,12 @@ namespace Content.Server.Inventory
|
|||||||
SubscribeLocalEvent<InventoryComponent, ElectrocutionAttemptEvent>(OnElectrocutionAttempt);
|
SubscribeLocalEvent<InventoryComponent, ElectrocutionAttemptEvent>(OnElectrocutionAttempt);
|
||||||
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(OnSlipAttemptEvent);
|
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(OnSlipAttemptEvent);
|
||||||
SubscribeLocalEvent<InventoryComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
SubscribeLocalEvent<InventoryComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||||
|
SubscribeLocalEvent<InventoryComponent, ModifyChangedTemperatureEvent>(OnModifyTemperature);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnModifyTemperature(EntityUid uid, InventoryComponent component, ModifyChangedTemperatureEvent args)
|
||||||
|
{
|
||||||
|
RelayInventoryEvent(component, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSlipAttemptEvent(EntityUid uid, InventoryComponent component, SlipAttemptEvent args)
|
private void OnSlipAttemptEvent(EntityUid uid, InventoryComponent component, SlipAttemptEvent args)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -18,22 +19,30 @@ namespace Content.Server.Temperature.Components
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Temperature";
|
public override string Name => "Temperature";
|
||||||
|
|
||||||
[DataField("heatDamageThreshold")]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
private float _heatDamageThreshold = default;
|
|
||||||
[DataField("coldDamageThreshold")]
|
|
||||||
private float _coldDamageThreshold = default;
|
|
||||||
[DataField("tempDamageCoefficient")]
|
|
||||||
private float _tempDamageCoefficient = 1;
|
|
||||||
[DataField("currentTemperature")]
|
|
||||||
public float CurrentTemperature { get; set; } = Atmospherics.T20C;
|
public float CurrentTemperature { get; set; } = Atmospherics.T20C;
|
||||||
[DataField("specificHeat")]
|
|
||||||
private float _specificHeat = Atmospherics.MinimumHeatCapacity;
|
|
||||||
|
|
||||||
[ViewVariables] public float HeatDamageThreshold => _heatDamageThreshold;
|
[DataField("heatDamageThreshold")]
|
||||||
[ViewVariables] public float ColdDamageThreshold => _coldDamageThreshold;
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[ViewVariables] public float TempDamageCoefficient => _tempDamageCoefficient;
|
public float HeatDamageThreshold = 360f;
|
||||||
[ViewVariables] public float SpecificHeat => _specificHeat;
|
|
||||||
[ViewVariables] public float HeatCapacity {
|
[DataField("coldDamageThreshold")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float ColdDamageThreshold = 260f;
|
||||||
|
|
||||||
|
[DataField("specificHeat")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float SpecificHeat = 50f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How well does the air surrounding you merge into your body temperature?
|
||||||
|
/// </summary>
|
||||||
|
[DataField("atmosTemperatureTransferEfficiency")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float AtmosTemperatureTransferEfficiency = 0.1f;
|
||||||
|
|
||||||
|
[ViewVariables] public float HeatCapacity
|
||||||
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Owner.TryGetComponent<IPhysBody>(out var physics))
|
if (Owner.TryGetComponent<IPhysBody>(out var physics))
|
||||||
@@ -52,5 +61,14 @@ namespace Content.Server.Temperature.Components
|
|||||||
[DataField("heatDamage", required: true)]
|
[DataField("heatDamage", required: true)]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public DamageSpecifier HeatDamage = default!;
|
public DamageSpecifier HeatDamage = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Temperature won't do more than this amount of damage per second.
|
||||||
|
///
|
||||||
|
/// Okay it genuinely reaches this basically immediately for a plasma fire.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("damageCap")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public FixedPoint2 DamageCap = FixedPoint2.New(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
|
using Content.Server.Atmos.Components;
|
||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Temperature.Components;
|
using Content.Server.Temperature.Components;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
@@ -14,11 +18,47 @@ namespace Content.Server.Temperature.Systems
|
|||||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All the components that will have their damage updated at the end of the tick.
|
||||||
|
/// This is done because both AtmosExposed and Flammable call ChangeHeat in the same tick, meaning
|
||||||
|
/// that we need some mechanism to ensure it doesn't double dip on damage for both calls.
|
||||||
|
/// </summary>
|
||||||
|
public HashSet<TemperatureComponent> ShouldUpdateDamage = new();
|
||||||
|
|
||||||
|
public float UpdateInterval = 1.0f;
|
||||||
|
|
||||||
|
private float _accumulatedFrametime = 0.0f;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<TemperatureComponent, OnTemperatureChangeEvent>(ChangeDamage);
|
SubscribeLocalEvent<TemperatureComponent, OnTemperatureChangeEvent>(EnqueueDamage);
|
||||||
SubscribeLocalEvent<TemperatureComponent, AtmosExposedUpdateEvent>(OnAtmosExposedUpdate);
|
SubscribeLocalEvent<TemperatureComponent, AtmosExposedUpdateEvent>(OnAtmosExposedUpdate);
|
||||||
SubscribeLocalEvent<ServerAlertsComponent, OnTemperatureChangeEvent>(ServerAlert);
|
SubscribeLocalEvent<ServerAlertsComponent, OnTemperatureChangeEvent>(ServerAlert);
|
||||||
|
SubscribeLocalEvent<TemperatureProtectionComponent, ModifyChangedTemperatureEvent>(OnTemperatureChangeAttempt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(float frameTime)
|
||||||
|
{
|
||||||
|
base.Update(frameTime);
|
||||||
|
|
||||||
|
_accumulatedFrametime += frameTime;
|
||||||
|
|
||||||
|
if (_accumulatedFrametime < UpdateInterval)
|
||||||
|
return;
|
||||||
|
_accumulatedFrametime -= UpdateInterval;
|
||||||
|
|
||||||
|
if (!ShouldUpdateDamage.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var comp in ShouldUpdateDamage)
|
||||||
|
{
|
||||||
|
if (comp.Deleted || comp.Paused)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ChangeDamage(comp.OwnerUid, comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShouldUpdateDamage.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ForceChangeTemperature(EntityUid uid, float temp, TemperatureComponent? temperature = null)
|
public void ForceChangeTemperature(EntityUid uid, float temp, TemperatureComponent? temperature = null)
|
||||||
@@ -32,10 +72,17 @@ namespace Content.Server.Temperature.Systems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReceiveHeat(EntityUid uid, float heatAmount, TemperatureComponent? temperature = null)
|
public void ChangeHeat(EntityUid uid, float heatAmount, bool ignoreHeatResistance=false, TemperatureComponent? temperature = null)
|
||||||
{
|
{
|
||||||
if (Resolve(uid, ref temperature))
|
if (Resolve(uid, ref temperature))
|
||||||
{
|
{
|
||||||
|
if (!ignoreHeatResistance)
|
||||||
|
{
|
||||||
|
var ev = new ModifyChangedTemperatureEvent(heatAmount);
|
||||||
|
RaiseLocalEvent(uid, ev, false);
|
||||||
|
heatAmount = ev.TemperatureDelta;
|
||||||
|
}
|
||||||
|
|
||||||
float lastTemp = temperature.CurrentTemperature;
|
float lastTemp = temperature.CurrentTemperature;
|
||||||
temperature.CurrentTemperature += heatAmount / temperature.HeatCapacity;
|
temperature.CurrentTemperature += heatAmount / temperature.HeatCapacity;
|
||||||
float delta = temperature.CurrentTemperature - lastTemp;
|
float delta = temperature.CurrentTemperature - lastTemp;
|
||||||
@@ -44,24 +91,12 @@ namespace Content.Server.Temperature.Systems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveHeat(EntityUid uid, float heatAmount, TemperatureComponent? temperature = null)
|
|
||||||
{
|
|
||||||
if (Resolve(uid, ref temperature))
|
|
||||||
{
|
|
||||||
float lastTemp = temperature.CurrentTemperature;
|
|
||||||
temperature.CurrentTemperature -= heatAmount / temperature.HeatCapacity;
|
|
||||||
float delta = temperature.CurrentTemperature - lastTemp;
|
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new OnTemperatureChangeEvent(temperature.CurrentTemperature, lastTemp, delta));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnAtmosExposedUpdate(EntityUid uid, TemperatureComponent temperature, ref AtmosExposedUpdateEvent args)
|
private void OnAtmosExposedUpdate(EntityUid uid, TemperatureComponent temperature, ref AtmosExposedUpdateEvent args)
|
||||||
{
|
{
|
||||||
var temperatureDelta = args.GasMixture.Temperature - temperature.CurrentTemperature;
|
var temperatureDelta = args.GasMixture.Temperature - temperature.CurrentTemperature;
|
||||||
var tileHeatCapacity = _atmosphereSystem.GetHeatCapacity(args.GasMixture);
|
var tileHeatCapacity = _atmosphereSystem.GetHeatCapacity(args.GasMixture);
|
||||||
var heat = temperatureDelta * (tileHeatCapacity * temperature.HeatCapacity / (tileHeatCapacity + temperature.HeatCapacity));
|
var heat = temperatureDelta * (tileHeatCapacity * temperature.HeatCapacity / (tileHeatCapacity + temperature.HeatCapacity));
|
||||||
ReceiveHeat(uid, heat, temperature);
|
ChangeHeat(uid, heat * temperature.AtmosTemperatureTransferEfficiency, temperature: temperature );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ServerAlert(EntityUid uid, ServerAlertsComponent status, OnTemperatureChangeEvent args)
|
private void ServerAlert(EntityUid uid, ServerAlertsComponent status, OnTemperatureChangeEvent args)
|
||||||
@@ -94,33 +129,53 @@ namespace Content.Server.Temperature.Systems
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Heat mild.
|
// Heat mild.
|
||||||
case <= 345 and > 335:
|
case <= 360 and > 335:
|
||||||
status.ShowAlert(AlertType.Hot, 2);
|
status.ShowAlert(AlertType.Hot, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Heat strong.
|
// Heat strong.
|
||||||
case > 345:
|
case > 360:
|
||||||
status.ShowAlert(AlertType.Hot, 3);
|
status.ShowAlert(AlertType.Hot, 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeDamage(EntityUid uid, TemperatureComponent temperature, OnTemperatureChangeEvent args)
|
private void EnqueueDamage(EntityUid uid, TemperatureComponent component, OnTemperatureChangeEvent args)
|
||||||
|
{
|
||||||
|
ShouldUpdateDamage.Add(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeDamage(EntityUid uid, TemperatureComponent temperature)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetComponent<DamageableComponent>(uid, out var damage))
|
if (!EntityManager.TryGetComponent<DamageableComponent>(uid, out var damage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args.CurrentTemperature >= temperature.HeatDamageThreshold)
|
// See this link for where the scaling func comes from:
|
||||||
|
// https://www.desmos.com/calculator/0vknqtdvq9
|
||||||
|
// Based on a logistic curve, which caps out at MaxDamage
|
||||||
|
var heatK = 0.005;
|
||||||
|
var a = 1;
|
||||||
|
var y = temperature.DamageCap;
|
||||||
|
var c = y * 2;
|
||||||
|
|
||||||
|
if (temperature.CurrentTemperature >= temperature.HeatDamageThreshold)
|
||||||
{
|
{
|
||||||
int tempDamage = (int) Math.Floor((args.CurrentTemperature - temperature.HeatDamageThreshold) * temperature.TempDamageCoefficient);
|
var diff = Math.Abs(temperature.CurrentTemperature - temperature.HeatDamageThreshold);
|
||||||
|
var tempDamage = c / (1 + a * Math.Pow(Math.E, -heatK * diff)) - y;
|
||||||
_damageableSystem.TryChangeDamage(uid, temperature.HeatDamage * tempDamage);
|
_damageableSystem.TryChangeDamage(uid, temperature.HeatDamage * tempDamage);
|
||||||
}
|
}
|
||||||
else if (args.CurrentTemperature <= temperature.ColdDamageThreshold)
|
else if (temperature.CurrentTemperature <= temperature.ColdDamageThreshold)
|
||||||
{
|
{
|
||||||
int tempDamage = (int) Math.Floor((temperature.ColdDamageThreshold - args.CurrentTemperature) * temperature.TempDamageCoefficient);
|
var diff = Math.Abs(temperature.CurrentTemperature - temperature.ColdDamageThreshold);
|
||||||
|
var tempDamage =
|
||||||
|
Math.Sqrt(diff * (Math.Pow(temperature.DamageCap.Double(), 2) / temperature.ColdDamageThreshold));
|
||||||
_damageableSystem.TryChangeDamage(uid, temperature.ColdDamage * tempDamage);
|
_damageableSystem.TryChangeDamage(uid, temperature.ColdDamage * tempDamage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTemperatureChangeAttempt(EntityUid uid, TemperatureProtectionComponent component, ModifyChangedTemperatureEvent args)
|
||||||
|
{
|
||||||
|
args.TemperatureDelta *= component.Coefficient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,4 +192,14 @@ namespace Content.Server.Temperature.Systems
|
|||||||
TemperatureDelta = delta;
|
TemperatureDelta = delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ModifyChangedTemperatureEvent : EntityEventArgs
|
||||||
|
{
|
||||||
|
public float TemperatureDelta;
|
||||||
|
|
||||||
|
public ModifyChangedTemperatureEvent(float temperature)
|
||||||
|
{
|
||||||
|
TemperatureDelta = temperature;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
state: hot
|
state: hot
|
||||||
maxSeverity: 3
|
maxSeverity: 3
|
||||||
name: "[color=red]Too Hot[/color]"
|
name: "[color=red]Too Hot[/color]"
|
||||||
description: "It's [color=red]too hot![/color] Flee to space, or at least away from the flames."
|
description: "It's [color=red]too hot![/color] Get somewhere colder, take off any insulating clothing like a space suit, or at least get away from the flames."
|
||||||
|
|
||||||
- type: alert
|
- type: alert
|
||||||
alertType: Weightless
|
alertType: Weightless
|
||||||
|
|||||||
@@ -29,8 +29,10 @@
|
|||||||
- type: Clothing
|
- type: Clothing
|
||||||
size: 15
|
size: 15
|
||||||
- type: PressureProtection
|
- type: PressureProtection
|
||||||
highPressureMultiplier: 0.5
|
highPressureMultiplier: 0.3
|
||||||
lowPressureMultiplier: 100
|
lowPressureMultiplier: 100
|
||||||
|
- type: TemperatureProtection
|
||||||
|
coefficient: 0.1
|
||||||
- type: Armor
|
- type: Armor
|
||||||
modifiers:
|
modifiers:
|
||||||
coefficients:
|
coefficients:
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
name: base hardsuit
|
name: base hardsuit
|
||||||
components:
|
components:
|
||||||
- type: PressureProtection
|
- type: PressureProtection
|
||||||
highPressureMultiplier: 0.75
|
highPressureMultiplier: 0.5
|
||||||
lowPressureMultiplier: 100
|
lowPressureMultiplier: 100
|
||||||
|
- type: TemperatureProtection
|
||||||
|
coefficient: 0.001 # yes it needs to be this low, fires are fucking deadly apparently!!!!
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
size: 25
|
size: 25
|
||||||
- type: Armor
|
- type: Armor
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
- type: PressureProtection
|
- type: PressureProtection
|
||||||
highPressureMultiplier: 0.85
|
highPressureMultiplier: 0.85
|
||||||
lowPressureMultiplier: 25
|
lowPressureMultiplier: 25
|
||||||
|
- type: TemperatureProtection
|
||||||
|
coefficient: 0.001
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Clothing/OuterClothing/Suits/fire.rsi
|
sprite: Clothing/OuterClothing/Suits/fire.rsi
|
||||||
|
|
||||||
@@ -42,6 +44,11 @@
|
|||||||
components:
|
components:
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Clothing/OuterClothing/Suits/rad.rsi
|
sprite: Clothing/OuterClothing/Suits/rad.rsi
|
||||||
|
- type: Armor
|
||||||
|
modifiers:
|
||||||
|
coefficients:
|
||||||
|
Heat: 0.90
|
||||||
|
Radiation: 0.05
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Clothing/OuterClothing/Suits/rad.rsi
|
sprite: Clothing/OuterClothing/Suits/rad.rsi
|
||||||
|
|
||||||
|
|||||||
@@ -63,15 +63,11 @@
|
|||||||
- type: Flammable
|
- type: Flammable
|
||||||
fireSpread: true
|
fireSpread: true
|
||||||
canResistFire: true
|
canResistFire: true
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Heat : 1
|
|
||||||
- type: Temperature
|
- type: Temperature
|
||||||
heatDamageThreshold: 360
|
heatDamageThreshold: 360
|
||||||
coldDamageThreshold: 260
|
coldDamageThreshold: 260
|
||||||
currentTemperature: 310.15
|
currentTemperature: 310.15
|
||||||
specificHeat: 42
|
specificHeat: 42
|
||||||
tempDamageCoefficient: 0.1
|
|
||||||
heatDamage:
|
heatDamage:
|
||||||
types:
|
types:
|
||||||
Heat : 1 #per second, scales with temperature & other constants
|
Heat : 1 #per second, scales with temperature & other constants
|
||||||
@@ -148,11 +144,11 @@
|
|||||||
types:
|
types:
|
||||||
Blunt: 1 #per second, scales with pressure and other constants.
|
Blunt: 1 #per second, scales with pressure and other constants.
|
||||||
- type: Respirator
|
- type: Respirator
|
||||||
metabolismHeat: 5000
|
metabolismHeat: 800
|
||||||
radiatedHeat: 400
|
radiatedHeat: 100
|
||||||
implicitHeatRegulation: 5000
|
implicitHeatRegulation: 250
|
||||||
sweatHeatRegulation: 5000
|
sweatHeatRegulation: 500
|
||||||
shiveringHeatRegulation: 5000
|
shiveringHeatRegulation: 500
|
||||||
normalBodyTemperature: 310.15
|
normalBodyTemperature: 310.15
|
||||||
thermalRegulationTemperatureThreshold: 25
|
thermalRegulationTemperatureThreshold: 25
|
||||||
needsGases:
|
needsGases:
|
||||||
@@ -171,7 +167,6 @@
|
|||||||
coldDamageThreshold: 260
|
coldDamageThreshold: 260
|
||||||
currentTemperature: 310.15
|
currentTemperature: 310.15
|
||||||
specificHeat: 42
|
specificHeat: 42
|
||||||
tempDamageCoefficient: 0.1
|
|
||||||
coldDamage:
|
coldDamage:
|
||||||
types:
|
types:
|
||||||
Cold : 1 #per second, scales with temperature & other constants
|
Cold : 1 #per second, scales with temperature & other constants
|
||||||
|
|||||||
@@ -173,15 +173,11 @@
|
|||||||
- type: Flammable
|
- type: Flammable
|
||||||
fireSpread: true
|
fireSpread: true
|
||||||
canResistFire: true
|
canResistFire: true
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Heat : 1 #per second, scales with number of fire 'stacks'
|
|
||||||
- type: Temperature
|
- type: Temperature
|
||||||
heatDamageThreshold: 360
|
heatDamageThreshold: 360
|
||||||
coldDamageThreshold: 260
|
coldDamageThreshold: 260
|
||||||
currentTemperature: 310.15
|
currentTemperature: 310.15
|
||||||
specificHeat: 42
|
specificHeat: 42
|
||||||
tempDamageCoefficient: 0.1
|
|
||||||
coldDamage:
|
coldDamage:
|
||||||
types:
|
types:
|
||||||
Cold : 1 #per second, scales with temperature & other constants
|
Cold : 1 #per second, scales with temperature & other constants
|
||||||
@@ -195,11 +191,11 @@
|
|||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Biological
|
damageContainer: Biological
|
||||||
- type: Respirator
|
- type: Respirator
|
||||||
metabolismHeat: 5000
|
metabolismHeat: 800
|
||||||
radiatedHeat: 400
|
radiatedHeat: 100
|
||||||
implicitHeatRegulation: 5000
|
implicitHeatRegulation: 500
|
||||||
sweatHeatRegulation: 5000
|
sweatHeatRegulation: 2000
|
||||||
shiveringHeatRegulation: 5000
|
shiveringHeatRegulation: 2000
|
||||||
normalBodyTemperature: 310.15
|
normalBodyTemperature: 310.15
|
||||||
thermalRegulationTemperatureThreshold: 25
|
thermalRegulationTemperatureThreshold: 25
|
||||||
needsGases:
|
needsGases:
|
||||||
|
|||||||
@@ -43,9 +43,6 @@
|
|||||||
- type: AtmosExposed
|
- type: AtmosExposed
|
||||||
- type: Flammable
|
- type: Flammable
|
||||||
fireSpread: true
|
fireSpread: true
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Heat : 1 #per second, scales with number of fire 'stacks'
|
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
- type: FireVisualizer
|
- type: FireVisualizer
|
||||||
|
|||||||
Reference in New Issue
Block a user