@@ -41,7 +41,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem
4141{
4242 [ Dependency ] private readonly IAdminLogManager _adminLogger = default ! ;
4343 [ Dependency ] private readonly IGameTiming _timing = default ! ;
44- [ Dependency ] private readonly IMapManager _mapManager = default ! ;
44+ [ Dependency ] private readonly SharedMapSystem _map = default ! ;
4545 [ Dependency ] private readonly IPrototypeManager _prototypeManager = default ! ;
4646 [ Dependency ] private readonly IRobustRandom _random = default ! ;
4747 [ Dependency ] private readonly ITileDefinitionManager _tileDefMan = default ! ;
@@ -124,7 +124,7 @@ private void OnPuddleSpread(Entity<PuddleComponent> entity, ref SpreadNeighborsE
124124 foreach ( var neighbor in args . NeighborFreeTiles )
125125 {
126126 var split = overflow . SplitSolution ( spillAmount ) ;
127- TrySpillAt ( neighbor . Grid . GridTileToLocal ( neighbor . Tile ) , split , out _ , false ) ;
127+ TrySpillAt ( _map . GridTileToLocal ( neighbor . Tile . GridUid , neighbor . Grid , neighbor . Tile . GridIndices ) , split , out _ , false ) ;
128128 args . Updates -- ;
129129
130130 if ( args . Updates <= 0 )
@@ -612,13 +612,14 @@ public bool TrySpillAt(EntityCoordinates coordinates, Solution solution, out Ent
612612 return false ;
613613 }
614614
615- if ( ! _mapManager . TryGetGrid ( coordinates . GetGridUid ( EntityManager ) , out var mapGrid ) )
615+ var gridUid = coordinates . GetGridUid ( EntityManager ) ;
616+ if ( ! TryComp < MapGridComponent > ( gridUid , out var mapGrid ) )
616617 {
617618 puddleUid = EntityUid . Invalid ;
618619 return false ;
619620 }
620621
621- return TrySpillAt ( mapGrid . GetTileRef ( coordinates ) , solution , out puddleUid , sound ) ;
622+ return TrySpillAt ( _map . GetTileRef ( gridUid . Value , mapGrid , coordinates ) , solution , out puddleUid , sound ) ;
622623 }
623624
624625 /// <summary>
@@ -657,7 +658,7 @@ public bool TrySpillAt(TileRef tileRef, Solution solution, out EntityUid puddleU
657658
658659 // Let's not spill to invalid grids.
659660 var gridId = tileRef . GridUid ;
660- if ( ! _mapManager . TryGetGrid ( gridId , out var mapGrid ) )
661+ if ( ! TryComp < MapGridComponent > ( gridId , out var mapGrid ) )
661662 {
662663 puddleUid = EntityUid . Invalid ;
663664 return false ;
@@ -678,7 +679,7 @@ public bool TrySpillAt(TileRef tileRef, Solution solution, out EntityUid puddleU
678679
679680 // Get normalized co-ordinate for spill location and spill it in the centre
680681 // TODO: Does SnapGrid or something else already do this?
681- var anchored = mapGrid . GetAnchoredEntitiesEnumerator ( tileRef . GridIndices ) ;
682+ var anchored = _map . GetAnchoredEntitiesEnumerator ( gridId , mapGrid , tileRef . GridIndices ) ;
682683 var puddleQuery = GetEntityQuery < PuddleComponent > ( ) ;
683684 var sparklesQuery = GetEntityQuery < EvaporationSparkleComponent > ( ) ;
684685
@@ -703,7 +704,7 @@ public bool TrySpillAt(TileRef tileRef, Solution solution, out EntityUid puddleU
703704 return true ;
704705 }
705706
706- var coords = mapGrid . GridTileToLocal ( tileRef . GridIndices ) ;
707+ var coords = _map . GridTileToLocal ( gridId , mapGrid , tileRef . GridIndices ) ;
707708 puddleUid = EntityManager . SpawnEntity ( "Puddle" , coords ) ;
708709 EnsureComp < PuddleComponent > ( puddleUid ) ;
709710 if ( TryAddSolution ( puddleUid , solution , sound ) )
@@ -740,7 +741,7 @@ public bool TryGetPuddle(TileRef tile, out EntityUid puddleUid)
740741 if ( ! TryComp < MapGridComponent > ( tile . GridUid , out var grid ) )
741742 return false ;
742743
743- var anc = grid . GetAnchoredEntitiesEnumerator ( tile . GridIndices ) ;
744+ var anc = _map . GetAnchoredEntitiesEnumerator ( tile . GridUid , grid , tile . GridIndices ) ;
744745 var puddleQuery = GetEntityQuery < PuddleComponent > ( ) ;
745746
746747 while ( anc . MoveNext ( out var ent ) )
0 commit comments