Fix misc. flesh anomaly exceptions (#15750)
This commit is contained in:
parent
c7ba2a666b
commit
6abe83cb43
1 changed files with 7 additions and 0 deletions
|
|
@ -63,12 +63,19 @@ public sealed class FleshAnomalySystem : EntitySystem
|
|||
|
||||
private void SpawnMonstersOnOpenTiles(FleshAnomalyComponent component, TransformComponent xform, int amount, float radius)
|
||||
{
|
||||
if (!component.Spawns.Any())
|
||||
return;
|
||||
|
||||
if (!_map.TryGetGrid(xform.GridUid, out var grid))
|
||||
return;
|
||||
|
||||
var localpos = xform.Coordinates.Position;
|
||||
var tilerefs = grid.GetLocalTilesIntersecting(
|
||||
new Box2(localpos + (-radius, -radius), localpos + (radius, radius))).ToArray();
|
||||
|
||||
if (tilerefs.Length == 0)
|
||||
return;
|
||||
|
||||
_random.Shuffle(tilerefs);
|
||||
var physQuery = GetEntityQuery<PhysicsComponent>();
|
||||
var amountCounter = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue