Spreaders travels across connected grids and SpreaderIgnore tag (#15419)

This commit is contained in:
metalgearsloth
2023-04-25 06:04:49 +10:00
committed by GitHub
parent 028c363608
commit 1cde3ff112
8 changed files with 85 additions and 58 deletions

View File

@@ -86,14 +86,6 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
return;
}
var xform = Transform(uid);
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
{
RemCompDeferred<EdgeSpreaderComponent>(uid);
return;
}
var puddleQuery = GetEntityQuery<PuddleComponent>();
// For overflows, we never go to a fully evaporative tile just to avoid continuously having to mop it.
@@ -152,10 +144,10 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
spillCount = Math.Min(args.NeighborFreeTiles.Count, spillCount);
var spillAmount = overflow.Volume / spillCount;
foreach (var tile in args.NeighborFreeTiles)
foreach (var neighbor in args.NeighborFreeTiles)
{
var split = overflow.SplitSolution(spillAmount);
TrySpillAt(grid.GridTileToLocal(tile), split, out _, false);
TrySpillAt(neighbor.Grid.GridTileToLocal(neighbor.Tile), split, out _, false);
args.Updates--;
if (args.Updates <= 0)

View File

@@ -73,7 +73,6 @@ public sealed class SmokeSystem : EntitySystem
private void OnSmokeSpread(EntityUid uid, SmokeComponent component, ref SpreadNeighborsEvent args)
{
if (component.SpreadAmount == 0 ||
args.Grid == null ||
!_solutionSystem.TryGetSolution(uid, SmokeComponent.SolutionName, out var solution) ||
args.NeighborFreeTiles.Count == 0)
{
@@ -94,9 +93,9 @@ public sealed class SmokeSystem : EntitySystem
var smokePerSpread = component.SpreadAmount / args.NeighborFreeTiles.Count;
component.SpreadAmount -= smokePerSpread;
foreach (var tile in args.NeighborFreeTiles)
foreach (var neighbor in args.NeighborFreeTiles)
{
var coords = args.Grid.GridTileToLocal(tile);
var coords = neighbor.Grid.GridTileToLocal(neighbor.Tile);
var ent = Spawn(prototype.ID, coords.SnapToGrid());
var neighborSmoke = EnsureComp<SmokeComponent>(ent);
neighborSmoke.SpreadAmount = Math.Max(0, smokePerSpread - 1);