Refactors TemperatureComponent and AtmosExposed to ECS (#4927)
Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
26
Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs
Normal file
26
Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
/* doesn't seem to be a use for this at the moment, so it's disabled
|
||||
public class AtmosExposedSystem : EntitySystem
|
||||
{}
|
||||
*/
|
||||
|
||||
public readonly struct AtmosExposedUpdateEvent
|
||||
{
|
||||
public readonly EntityCoordinates Coordinates;
|
||||
public readonly GasMixture GasMixture;
|
||||
|
||||
public AtmosExposedUpdateEvent(EntityCoordinates coordinates, GasMixture mixture)
|
||||
{
|
||||
Coordinates = coordinates;
|
||||
GasMixture = mixture;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.Atmos.EntitySystems;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -70,10 +73,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
|
||||
{
|
||||
// TODO ATMOS: Kill this with fire.
|
||||
var tile = GetTileMixture(exposed.Owner.Transform.Coordinates);
|
||||
if (tile == null) continue;
|
||||
exposed.Update(tile, _exposedTimer, this);
|
||||
var updateEvent = new AtmosExposedUpdateEvent(exposed.Owner.Transform.Coordinates, tile);
|
||||
RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent);
|
||||
}
|
||||
|
||||
_exposedTimer -= ExposedUpdateDelay;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Atmos.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Stunnable.Components;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
@@ -27,6 +28,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
|
||||
|
||||
private const float MinimumFireStacks = -10f;
|
||||
private const float MaximumFireStacks = 20f;
|
||||
@@ -207,14 +209,10 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (flammable.FireStacks > 0)
|
||||
{
|
||||
if (flammable.Owner.TryGetComponent(out TemperatureComponent? temp))
|
||||
{
|
||||
temp.ReceiveHeat(200 * flammable.FireStacks);
|
||||
}
|
||||
|
||||
_temperatureSystem.ReceiveHeat(uid, 200 * flammable.FireStacks);
|
||||
// TODO ATMOS Fire resistance from armor
|
||||
var damageScale = Math.Min((int) (flammable.FireStacks * 2.5f), 10);
|
||||
_damageableSystem.TryChangeDamage(flammable.Owner.Uid, flammable.Damage * damageScale);
|
||||
_damageableSystem.TryChangeDamage(uid, flammable.Damage * damageScale);
|
||||
|
||||
AdjustFireStacks(uid, -0.1f * (flammable.Resisting ? 10f : 1f), flammable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user