mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
Make fire leave burnt decals on the tiles (#31939)
* Make fire leave burnt decals on the tiles * License * Yes * Update * Spelling error * Prototypes reload support * To array
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
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;
|
||||
@@ -56,7 +58,30 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user