Remove remaining usages of MapManager Grid/Tile changed and NextMapId (#7302)
This commit is contained in:
@@ -114,9 +114,8 @@ namespace Content.IntegrationTests.Tests.Damageable
|
|||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var mapId = sMapManager.NextMapId();
|
var map = sMapManager.CreateMap();
|
||||||
var coordinates = new MapCoordinates(0, 0, mapId);
|
var coordinates = new MapCoordinates(0, 0, map);
|
||||||
sMapManager.CreateMap(mapId);
|
|
||||||
|
|
||||||
sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates);
|
sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates);
|
||||||
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDamageableEntity);
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDamageableEntity);
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var dir = new ResourcePath(mapPath).Directory;
|
var dir = new ResourcePath(mapPath).Directory;
|
||||||
resManager.UserData.CreateDir(dir);
|
resManager.UserData.CreateDir(dir);
|
||||||
|
|
||||||
var nextMapId = mapManager.NextMapId();
|
var mapId = mapManager.CreateMap();
|
||||||
var mapId = mapManager.CreateMap(nextMapId);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
@@ -51,7 +50,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
mapLoader.SaveMap(mapId, mapPath);
|
mapLoader.SaveMap(mapId, mapPath);
|
||||||
|
|
||||||
mapManager.DeleteMap(nextMapId);
|
mapManager.DeleteMap(mapId);
|
||||||
});
|
});
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Interaction;
|
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -23,23 +22,14 @@ namespace Content.Shared.SubFloor
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
MapManager.GridChanged += MapManagerOnGridChanged;
|
SubscribeLocalEvent<GridModifiedEvent>(OnGridChanged);
|
||||||
MapManager.TileChanged += MapManagerOnTileChanged;
|
SubscribeLocalEvent<TileChangedEvent>(OnTileChanged);
|
||||||
|
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, ComponentStartup>(OnSubFloorStarted);
|
SubscribeLocalEvent<SubFloorHideComponent, ComponentStartup>(OnSubFloorStarted);
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, ComponentShutdown>(OnSubFloorTerminating);
|
SubscribeLocalEvent<SubFloorHideComponent, ComponentShutdown>(OnSubFloorTerminating);
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, AnchorStateChangedEvent>(HandleAnchorChanged);
|
SubscribeLocalEvent<SubFloorHideComponent, AnchorStateChangedEvent>(HandleAnchorChanged);
|
||||||
SubscribeLocalEvent<SubFloorHideComponent, GettingInteractedWithAttemptEvent>(OnInteractionAttempt);
|
SubscribeLocalEvent<SubFloorHideComponent, GettingInteractedWithAttemptEvent>(OnInteractionAttempt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
|
||||||
{
|
|
||||||
base.Shutdown();
|
|
||||||
|
|
||||||
MapManager.GridChanged -= MapManagerOnGridChanged;
|
|
||||||
MapManager.TileChanged -= MapManagerOnTileChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInteractionAttempt(EntityUid uid, SubFloorHideComponent component, GettingInteractedWithAttemptEvent args)
|
private void OnInteractionAttempt(EntityUid uid, SubFloorHideComponent component, GettingInteractedWithAttemptEvent args)
|
||||||
{
|
{
|
||||||
// No interactions with entities hidden under floor tiles.
|
// No interactions with entities hidden under floor tiles.
|
||||||
@@ -83,22 +73,22 @@ namespace Content.Shared.SubFloor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MapManagerOnTileChanged(object? sender, TileChangedEventArgs e)
|
private void OnTileChanged(TileChangedEvent args)
|
||||||
{
|
{
|
||||||
if (e.OldTile.IsEmpty)
|
if (args.OldTile.IsEmpty)
|
||||||
return; // Nothing is anchored here anyways.
|
return; // Nothing is anchored here anyways.
|
||||||
|
|
||||||
if (e.NewTile.Tile.IsEmpty)
|
if (args.NewTile.Tile.IsEmpty)
|
||||||
return; // Anything that was here will be unanchored anyways.
|
return; // Anything that was here will be unanchored anyways.
|
||||||
|
|
||||||
UpdateTile(MapManager.GetGrid(e.NewTile.GridIndex), e.NewTile.GridIndices);
|
UpdateTile(MapManager.GetGrid(args.NewTile.GridIndex), args.NewTile.GridIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MapManagerOnGridChanged(object? sender, GridChangedEventArgs e)
|
private void OnGridChanged(GridModifiedEvent args)
|
||||||
{
|
{
|
||||||
foreach (var modified in e.Modified)
|
foreach (var modified in args.Modified)
|
||||||
{
|
{
|
||||||
UpdateTile(e.Grid, modified.position);
|
UpdateTile(args.Grid, modified.position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user