metal foam grenades (#29428)

* metal foam grenades

* wow okay

* meh

* bruh

* test

* push
This commit is contained in:
Nemanja
2024-07-07 10:26:58 -04:00
committed by GitHub
parent ff93070d25
commit 21d0f85cc2
19 changed files with 219 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Shuttles.Components;
using Content.Shared.Atmos;
using Content.Shared.Maps;
using Content.Shared.Spreader;
using Content.Shared.Tag;
using Robust.Shared.Collections;
@@ -175,11 +176,12 @@ public sealed class SpreaderSystem : EntitySystem
/// </summary>
public void GetNeighbors(EntityUid uid, TransformComponent comp, ProtoId<EdgeSpreaderPrototype> prototype, out ValueList<(MapGridComponent, TileRef)> freeTiles, out ValueList<Vector2i> occupiedTiles, out ValueList<EntityUid> neighbors)
{
// TODO remove occupiedTiles -- its currently unused and just slows this method down.
DebugTools.Assert(_prototype.HasIndex(prototype));
freeTiles = [];
occupiedTiles = [];
neighbors = [];
// TODO remove occupiedTiles -- its currently unused and just slows this method down.
if (!_prototype.TryIndex(prototype, out var spreaderPrototype))
return;
if (!TryComp<MapGridComponent>(comp.GridUid, out var grid))
return;
@@ -244,6 +246,9 @@ public sealed class SpreaderSystem : EntitySystem
if (!_map.TryGetTileRef(neighborEnt, neighborGrid, neighborPos, out var tileRef) || tileRef.Tile.IsEmpty)
continue;
if (spreaderPrototype.PreventSpreadOnSpaced && tileRef.Tile.IsSpace())
continue;
var directionEnumerator = _map.GetAnchoredEntitiesEnumerator(neighborEnt, neighborGrid, neighborPos);
var occupied = false;
@@ -335,4 +340,12 @@ public sealed class SpreaderSystem : EntitySystem
}
}
}
public bool RequiresFloorToSpread(EntProtoId<EdgeSpreaderComponent> spreader)
{
if (!_prototype.Index(spreader).TryGetComponent<EdgeSpreaderComponent>(out var spreaderComp, EntityManager.ComponentFactory))
return false;
return _prototype.Index(spreaderComp.Id).PreventSpreadOnSpaced;
}
}