Refactor Flammable to be ECS. (#4671)

- Refactor IHotItem into IsHotEvent.
- Refactor IFireAct into TileFireEvent.
This commit is contained in:
Vera Aguilera Puerto
2021-09-22 11:05:33 +02:00
committed by GitHub
parent 9bde39c533
commit 6cea9cb973
21 changed files with 348 additions and 268 deletions

View File

@@ -1,13 +1,15 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions;
using Content.Server.Coordinates.Helpers;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Atmos.EntitySystems
{
public partial class AtmosphereSystem
{
[Dependency] private readonly GridTileLookupSystem _gridtileLookupSystem = default!;
private void ProcessHotspot(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile)
{
if (!tile.Hotspot.Valid)
@@ -137,14 +139,11 @@ namespace Content.Server.Atmos.EntitySystems
Merge(tile.Air, affected);
}
var tileRef = tile.GridIndices.GetTileRef(tile.GridIndex, _mapManager);
var fireEvent = new TileFireEvent(tile.Hotspot.Temperature, tile.Hotspot.Volume);
foreach (var entity in tileRef.GetEntitiesInTileFast())
foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices))
{
foreach (var fireAct in entity.GetAllComponents<IFireAct>())
{
fireAct.FireAct(tile.Hotspot.Temperature, tile.Hotspot.Volume);
}
RaiseLocalEvent(entity.Uid, fireEvent, false);
}
}
}