Fix misc. flesh anomaly exceptions (#15750)
This commit is contained in:
@@ -63,12 +63,19 @@ public sealed class FleshAnomalySystem : EntitySystem
|
|||||||
|
|
||||||
private void SpawnMonstersOnOpenTiles(FleshAnomalyComponent component, TransformComponent xform, int amount, float radius)
|
private void SpawnMonstersOnOpenTiles(FleshAnomalyComponent component, TransformComponent xform, int amount, float radius)
|
||||||
{
|
{
|
||||||
|
if (!component.Spawns.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_map.TryGetGrid(xform.GridUid, out var grid))
|
if (!_map.TryGetGrid(xform.GridUid, out var grid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var localpos = xform.Coordinates.Position;
|
var localpos = xform.Coordinates.Position;
|
||||||
var tilerefs = grid.GetLocalTilesIntersecting(
|
var tilerefs = grid.GetLocalTilesIntersecting(
|
||||||
new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray();
|
new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray();
|
||||||
|
|
||||||
|
if (tilerefs.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
_random.Shuffle(tilerefs);
|
_random.Shuffle(tilerefs);
|
||||||
var physQuery = GetEntityQuery<PhysicsComponent>();
|
var physQuery = GetEntityQuery<PhysicsComponent>();
|
||||||
var amountCounter = 0;
|
var amountCounter = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user