Remove explosion networking jank (#12733)

This commit is contained in:
Leon Friedrich
2022-11-27 23:24:35 +13:00
committed by GitHub
parent 85ce28c0a2
commit 2dc7663d1a
12 changed files with 237 additions and 326 deletions

View File

@@ -313,7 +313,7 @@ public sealed partial class ExplosionSystem : EntitySystem
return (grids, referenceGrid, radius);
}
public ExplosionEvent? GenerateExplosionPreview(SpawnExplosionEuiMsg.PreviewRequest request)
public ExplosionVisualsState? GenerateExplosionPreview(SpawnExplosionEuiMsg.PreviewRequest request)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
@@ -332,7 +332,19 @@ public sealed partial class ExplosionSystem : EntitySystem
Logger.Info($"Generated explosion preview with {area} tiles in {stopwatch.Elapsed.TotalMilliseconds}ms");
// the explosion event that **would** be sent to all clients, if it were a real explosion.
return GetExplosionEvent(request.Epicenter, request.TypeId, spaceMatrix, spaceData, gridData.Values, iterationIntensity);
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
foreach (var (grid, data) in gridData)
{
tileLists.Add(grid, data.TileLists);
}
return new ExplosionVisualsState(
request.Epicenter,
request.TypeId,
iterationIntensity,
spaceData?.TileLists,
tileLists, spaceMatrix,
spaceData?.TileSize ?? DefaultTileSize
);
}
}