Navmap rework (#26713)

* Optimized the drawing of lines and tracked entities

* Optimized nav map updating and added thin wall support

* Added support for thin doors

* Removed floor tile seams, more line drawing optimizations

* Fixed split grids not updating correctly

* Cleaned up NavMapControl code

* Fix nav map header

* Converted nav map updates from system network messages to delta-states

* Addressed review comments

* Fixed timing issue where NavMapSystem would update before AirtightSystem did
This commit is contained in:
chromiumboy
2024-04-17 12:59:31 -05:00
committed by GitHub
parent 20b16944ad
commit 009d06d978
8 changed files with 967 additions and 660 deletions

View File

@@ -12,6 +12,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
public override void Initialize()
{
@@ -59,12 +60,14 @@ namespace Content.Server.Atmos.EntitySystems
var gridId = xform.GridUid;
var coords = xform.Coordinates;
var tilePos = grid.TileIndicesFor(coords);
var tilePos = _mapSystem.TileIndicesFor(gridId.Value, grid, coords);
// Update and invalidate new position.
airtight.LastPosition = (gridId.Value, tilePos);
InvalidatePosition(gridId.Value, tilePos);
var airtightEv = new AirtightChanged(uid, airtight, (gridId.Value, tilePos));
RaiseLocalEvent(uid, ref airtightEv, true);
}
private void OnAirtightReAnchor(EntityUid uid, AirtightComponent airtight, ref ReAnchorEvent args)
@@ -74,6 +77,9 @@ namespace Content.Server.Atmos.EntitySystems
// Update and invalidate new position.
airtight.LastPosition = (gridId, args.TilePos);
InvalidatePosition(gridId, args.TilePos);
var airtightEv = new AirtightChanged(uid, airtight, (gridId, args.TilePos));
RaiseLocalEvent(uid, ref airtightEv, true);
}
}
@@ -153,6 +159,5 @@ namespace Content.Server.Atmos.EntitySystems
}
[ByRefEvent]
public readonly record struct AirtightChanged(EntityUid Entity, AirtightComponent Airtight,
(EntityUid Grid, Vector2i Tile) Position);
public readonly record struct AirtightChanged(EntityUid Entity, AirtightComponent Airtight, (EntityUid Grid, Vector2i Tile) Position);
}