using Content.Server.Atmos.Components;
-using Content.Server.Atmos.Reactions;
+using Content.Server.Decals;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Reactions;
-using Content.Shared.Audio;
using Content.Shared.Database;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
-using Robust.Shared.Player;
+using Robust.Shared.Random;
namespace Content.Server.Atmos.EntitySystems
{
public sealed partial class AtmosphereSystem
{
+ [Dependency] private readonly DecalSystem _decalSystem = default!;
+ [Dependency] private readonly IRobustRandom _random = default!;
+
private const int HotspotSoundCooldownCycles = 200;
private int _hotspotSoundCooldown = 0;
if (tile.Hotspot.Bypassing)
{
tile.Hotspot.State = 3;
- // TODO ATMOS: Burn tile here
+
+ var gridUid = ent.Owner;
+ var tilePos = tile.GridIndices;
+
+ // Get the existing decals on the tile
+ var tileDecals = _decalSystem.GetDecalsInRange(gridUid, tilePos);
+
+ // Count the burnt decals on the tile
+ var tileBurntDecals = 0;
+
+ foreach (var set in tileDecals)
+ {
+ if (Array.IndexOf(_burntDecals, set.Decal.Id) == -1)
+ continue;
+
+ tileBurntDecals++;
+
+ if (tileBurntDecals > 4)
+ break;
+ }
+
+ // Add a random burned decal to the tile only if there are less than 4 of them
+ if (tileBurntDecals < 4)
+ _decalSystem.TryAddDecal(_burntDecals[_random.Next(_burntDecals.Length)], new EntityCoordinates(gridUid, tilePos), out _, cleanable: true);
if (tile.Air.Temperature > Atmospherics.FireMinimumTemperatureToSpread)
{
using Content.Server.Fluids.EntitySystems;
using Content.Server.NodeContainer.EntitySystems;
using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Decals;
using Content.Shared.Doors.Components;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Physics.Systems;
+using Robust.Shared.Prototypes;
using Robust.Shared.Random;
+using System.Linq;
namespace Content.Server.Atmos.EntitySystems;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly MapSystem _map = default!;
+ [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] public readonly PuddleSystem Puddle = default!;
private const float ExposedUpdateDelay = 1f;
private EntityQuery<FirelockComponent> _firelockQuery;
private HashSet<EntityUid> _entSet = new();
+ private string[] _burntDecals = [];
+
public override void Initialize()
{
base.Initialize();
_firelockQuery = GetEntityQuery<FirelockComponent>();
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
+ SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReloaded);
+ CacheDecals();
}
public override void Shutdown()
InvalidateTile(ev.NewTile.GridUid, ev.NewTile.GridIndices);
}
+ private void OnPrototypesReloaded(PrototypesReloadedEventArgs ev)
+ {
+ if (ev.WasModified<DecalPrototype>())
+ CacheDecals();
+ }
+
public override void Update(float frameTime)
{
base.Update(frameTime);
_exposedTimer -= ExposedUpdateDelay;
}
+
+ private void CacheDecals()
+ {
+ _burntDecals = _prototypeManager.EnumeratePrototypes<DecalPrototype>().Where(x => x.Tags.Contains("burnt")).Select(x => x.ID).ToArray();
+ }
}
--- /dev/null
+- type: decal
+ id: burnt1
+ tags: ["burnt"]
+ defaultCleanable: true
+ sprite:
+ sprite: Decals/burnt.rsi
+ state: burnt1
+
+- type: decal
+ id: burnt2
+ tags: ["burnt"]
+ defaultCleanable: true
+ sprite:
+ sprite: Decals/burnt.rsi
+ state: burnt2
+
+- type: decal
+ id: burnt3
+ tags: ["burnt"]
+ defaultCleanable: true
+ sprite:
+ sprite: Decals/burnt.rsi
+ state: burnt3
+
+- type: decal
+ id: burnt4
+ tags: ["burnt"]
+ defaultCleanable: true
+ sprite:
+ sprite: Decals/burnt.rsi
+ state: burnt4
--- /dev/null
+{
+ "version": 1,
+ "size": {
+ "x": 32,
+ "y": 32
+ },
+ "license": "CC-BY-SA-3.0",
+ "copyright": "From https://github.com/BeeStation/BeeStation-Hornet/blob/master/icons/turf/turf_damage.dmi at f2d6fbdf36aa0951049498cf28e028a38e32fe0b",
+ "states": [
+ {
+ "name": "burnt1"
+
+ },
+ {
+ "name": "burnt2"
+
+ },
+ {
+ "name": "burnt3"
+
+ },
+ {
+ "name": "burnt4"
+
+ }
+ ]
+}