Content changes for mapgrid kill (#12567)
This commit is contained in:
@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.CustomControls;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||||
{
|
{
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class AddAtmosWindow : DefaultWindow
|
public sealed partial class AddAtmosWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private IEnumerable<IMapGrid>? _data;
|
private IEnumerable<MapGridComponent>? _data;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Robust.Client.UserInterface.CustomControls;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class AddGasWindow : DefaultWindow
|
public sealed partial class AddGasWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private IEnumerable<IMapGrid>? _gridData;
|
private IEnumerable<MapGridComponent>? _gridData;
|
||||||
private IEnumerable<GasPrototype>? _gasData;
|
private IEnumerable<GasPrototype>? _gasData;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Robust.Client.UserInterface.CustomControls;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class FillGasWindow : DefaultWindow
|
public sealed partial class FillGasWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private IEnumerable<IMapGrid>? _gridData;
|
private IEnumerable<MapGridComponent>? _gridData;
|
||||||
private IEnumerable<GasPrototype>? _gasData;
|
private IEnumerable<GasPrototype>? _gasData;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.CustomControls;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||||
{
|
{
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class SetTemperatureWindow : DefaultWindow
|
public sealed partial class SetTemperatureWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
private IEnumerable<IMapGrid>? _data;
|
private IEnumerable<MapGridComponent>? _data;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Robust.Client.AutoGenerated;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.ObjectsTab;
|
namespace Content.Client.Administration.UI.Tabs.ObjectsTab;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using static Robust.Client.GameObjects.SpriteComponent;
|
using static Robust.Client.GameObjects.SpriteComponent;
|
||||||
|
|
||||||
namespace Content.Client.IconSmoothing
|
namespace Content.Client.IconSmoothing
|
||||||
@@ -185,7 +186,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
var xform = xformQuery.GetComponent(uid);
|
var xform = xformQuery.GetComponent(uid);
|
||||||
|
|
||||||
IMapGrid? grid = null;
|
MapGridComponent? grid = null;
|
||||||
|
|
||||||
if (xform.Anchored)
|
if (xform.Anchored)
|
||||||
{
|
{
|
||||||
@@ -209,7 +210,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateNewSpriteCardinal(IMapGrid? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
private void CalculateNewSpriteCardinal(MapGridComponent? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
||||||
{
|
{
|
||||||
var dirs = CardinalConnectDirs.None;
|
var dirs = CardinalConnectDirs.None;
|
||||||
|
|
||||||
@@ -243,7 +244,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateNewSpriteCorners(IMapGrid? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
private void CalculateNewSpriteCorners(MapGridComponent? grid, IconSmoothComponent smooth, SpriteComponent sprite, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
||||||
{
|
{
|
||||||
var (cornerNE, cornerNW, cornerSW, cornerSE) = grid == null
|
var (cornerNE, cornerNW, cornerSW, cornerSE) = grid == null
|
||||||
? (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None)
|
? (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None)
|
||||||
@@ -260,7 +261,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
sprite.LayerSetState(CornerLayers.NW, $"{smooth.StateBase}{(int) cornerNW}");
|
sprite.LayerSetState(CornerLayers.NW, $"{smooth.StateBase}{(int) cornerNW}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid, IconSmoothComponent smooth, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
private (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(MapGridComponent grid, IconSmoothComponent smooth, TransformComponent xform, EntityQuery<IconSmoothComponent> smoothQuery)
|
||||||
{
|
{
|
||||||
var pos = grid.TileIndicesFor(xform.Coordinates);
|
var pos = grid.TileIndicesFor(xform.Coordinates);
|
||||||
var n = MatchingEntity(smooth, grid.GetAnchoredEntities(pos.Offset(Direction.North)), smoothQuery);
|
var n = MatchingEntity(smooth, grid.GetAnchoredEntities(pos.Offset(Direction.North)), smoothQuery);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -752,7 +753,7 @@ public sealed class PoolSettings
|
|||||||
public sealed class TestMapData
|
public sealed class TestMapData
|
||||||
{
|
{
|
||||||
public MapId MapId { get; set; }
|
public MapId MapId { get; set; }
|
||||||
public IMapGrid MapGrid { get; set; }
|
public MapGridComponent MapGrid { get; set; }
|
||||||
public EntityCoordinates GridCoords { get; set; }
|
public EntityCoordinates GridCoords { get; set; }
|
||||||
public MapCoordinates MapCoords { get; set; }
|
public MapCoordinates MapCoords { get; set; }
|
||||||
public TileRef Tile { get; set; }
|
public TileRef Tile { get; set; }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.DeviceNetwork
|
namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||||
{
|
{
|
||||||
@@ -189,7 +190,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
|||||||
DeviceNetworkComponent networkComponent1 = null;
|
DeviceNetworkComponent networkComponent1 = null;
|
||||||
DeviceNetworkComponent networkComponent2 = null;
|
DeviceNetworkComponent networkComponent2 = null;
|
||||||
WiredNetworkComponent wiredNetworkComponent = null;
|
WiredNetworkComponent wiredNetworkComponent = null;
|
||||||
IMapGrid grid = testMap.MapGrid;
|
MapGridComponent grid = testMap.MapGrid;
|
||||||
|
|
||||||
var testValue = "test";
|
var testValue = "test";
|
||||||
var payload = new NetworkPayload
|
var payload = new NetworkPayload
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var componentFactory = server.ResolveDependency<IComponentFactory>();
|
var componentFactory = server.ResolveDependency<IComponentFactory>();
|
||||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
||||||
|
|
||||||
IMapGrid grid = default;
|
MapGridComponent grid = default;
|
||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
@@ -224,7 +225,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var componentFactory = server.ResolveDependency<IComponentFactory>();
|
var componentFactory = server.ResolveDependency<IComponentFactory>();
|
||||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
||||||
|
|
||||||
IMapGrid grid = default;
|
MapGridComponent grid = default;
|
||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.FixedPoint;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ namespace Content.IntegrationTests.Tests.Fluids;
|
|||||||
[TestOf(typeof(FluidSpreaderSystem))]
|
[TestOf(typeof(FluidSpreaderSystem))]
|
||||||
public sealed class FluidSpill
|
public sealed class FluidSpill
|
||||||
{
|
{
|
||||||
private static PuddleComponent? GetPuddle(IEntityManager entityManager, IMapGrid mapGrid, Vector2i pos)
|
private static PuddleComponent? GetPuddle(IEntityManager entityManager, MapGridComponent mapGrid, Vector2i pos)
|
||||||
{
|
{
|
||||||
foreach (var uid in mapGrid.GetAnchoredEntities(pos))
|
foreach (var uid in mapGrid.GetAnchoredEntities(pos))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.FixedPoint;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Fluids
|
namespace Content.IntegrationTests.Tests.Fluids
|
||||||
@@ -54,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
|
var entitySystemManager = server.ResolveDependency<IEntitySystemManager>();
|
||||||
var spillSystem = entitySystemManager.GetEntitySystem<SpillableSystem>();
|
var spillSystem = entitySystemManager.GetEntitySystem<SpillableSystem>();
|
||||||
|
|
||||||
IMapGrid grid = null;
|
MapGridComponent grid = null;
|
||||||
|
|
||||||
// Remove all tiles
|
// Remove all tiles
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
@@ -93,7 +94,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
var metaSystem = entityManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
|
var metaSystem = entityManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
|
||||||
|
|
||||||
MapId sMapId = default;
|
MapId sMapId = default;
|
||||||
IMapGrid sGrid;
|
MapGridComponent sGrid;
|
||||||
EntityUid sGridId = default;
|
EntityUid sGridId = default;
|
||||||
EntityCoordinates sCoordinates = default;
|
EntityCoordinates sCoordinates = default;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
{
|
{
|
||||||
@@ -38,8 +39,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
EntityUid generator = default;
|
EntityUid generator = default;
|
||||||
var entityMan = server.ResolveDependency<IEntityManager>();
|
var entityMan = server.ResolveDependency<IEntityManager>();
|
||||||
|
|
||||||
IMapGrid grid1 = null;
|
MapGridComponent grid1 = null;
|
||||||
IMapGrid grid2 = null;
|
MapGridComponent grid2 = null;
|
||||||
|
|
||||||
// Create grids
|
// Create grids
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
@@ -87,7 +88,7 @@ public sealed class PrototypeSaveTest
|
|||||||
var compFact = server.ResolveDependency<IComponentFactory>();
|
var compFact = server.ResolveDependency<IComponentFactory>();
|
||||||
|
|
||||||
var prototypes = new List<EntityPrototype>();
|
var prototypes = new List<EntityPrototype>();
|
||||||
IMapGrid grid = default!;
|
MapGridComponent grid = default!;
|
||||||
EntityUid uid;
|
EntityUid uid;
|
||||||
MapId mapId = default;
|
MapId mapId = default;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Decals;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -43,7 +44,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
_decals = GetDecals();
|
_decals = GetDecals();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run(Image gridCanvas, IMapGrid grid)
|
public void Run(Image gridCanvas, MapGridComponent grid)
|
||||||
{
|
{
|
||||||
var stopwatch = new Stopwatch();
|
var stopwatch = new Stopwatch();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
@@ -136,7 +137,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
return decals;
|
return decals;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (float x, float y) TransformLocalPosition(Vector2 position, IMapGrid grid)
|
private (float x, float y) TransformLocalPosition(Vector2 position, MapGridComponent grid)
|
||||||
{
|
{
|
||||||
var xOffset = (int) -grid.LocalAABB.Left;
|
var xOffset = (int) -grid.LocalAABB.Left;
|
||||||
var yOffset = (int) -grid.LocalAABB.Bottom;
|
var yOffset = (int) -grid.LocalAABB.Bottom;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
@@ -59,7 +60,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
|
|
||||||
var tilePainter = new TilePainter(client, server);
|
var tilePainter = new TilePainter(client, server);
|
||||||
var entityPainter = new GridPainter(client, server);
|
var entityPainter = new GridPainter(client, server);
|
||||||
IMapGrid[] grids = null!;
|
MapGridComponent[] grids = null!;
|
||||||
var xformQuery = sEntityManager.GetEntityQuery<TransformComponent>();
|
var xformQuery = sEntityManager.GetEntityQuery<TransformComponent>();
|
||||||
|
|
||||||
await server.WaitPost(() =>
|
await server.WaitPost(() =>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
@@ -26,7 +27,7 @@ namespace Content.MapRenderer.Painters
|
|||||||
_cResourceCache = client.ResolveDependency<IResourceCache>();
|
_cResourceCache = client.ResolveDependency<IResourceCache>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run(Image gridCanvas, IMapGrid grid)
|
public void Run(Image gridCanvas, MapGridComponent grid)
|
||||||
{
|
{
|
||||||
var stopwatch = new Stopwatch();
|
var stopwatch = new Stopwatch();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Explosion.EntitySystems;
|
|||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.AME
|
namespace Content.Server.AME
|
||||||
@@ -37,7 +38,7 @@ namespace Content.Server.AME
|
|||||||
base.LoadNodes(groupNodes);
|
base.LoadNodes(groupNodes);
|
||||||
|
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
IMapGrid? grid = null;
|
MapGridComponent? grid = null;
|
||||||
|
|
||||||
foreach (var node in groupNodes)
|
foreach (var node in groupNodes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands;
|
namespace Content.Server.Administration.Commands;
|
||||||
@@ -38,11 +39,11 @@ public sealed class VariantizeCommand : IConsoleCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var tile in gridComp.Grid.GetAllTiles())
|
foreach (var tile in gridComp.GetAllTiles())
|
||||||
{
|
{
|
||||||
var def = tile.GetContentTileDefinition();
|
var def = tile.GetContentTileDefinition();
|
||||||
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
|
var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, random.Pick(def.PlacementVariants));
|
||||||
gridComp.Grid.SetTile(tile.GridIndices, newTile);
|
gridComp.SetTile(tile.GridIndices, newTile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Systems;
|
namespace Content.Server.Administration.Systems;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ using Content.Shared.Tabletop.Components;
|
|||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ using Content.Shared.Weapons.Ranged.Components;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Physics;
|
using Robust.Server.Physics;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
|
|||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Commands
|
namespace Content.Server.Atmos.Commands
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Administration;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Commands
|
namespace Content.Server.Atmos.Commands
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Explosion.EntitySystems;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems
|
namespace Content.Server.Atmos.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -58,7 +59,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
var gridId = xform.GridUid;
|
var gridId = xform.GridUid;
|
||||||
var coords = xform.Coordinates;
|
var coords = xform.Coordinates;
|
||||||
|
|
||||||
var tilePos = grid.Grid.TileIndicesFor(coords);
|
var tilePos = grid.TileIndicesFor(coords);
|
||||||
|
|
||||||
// Update and invalidate new position.
|
// Update and invalidate new position.
|
||||||
airtight.LastPosition = (gridId.Value, tilePos);
|
airtight.LastPosition = (gridId.Value, tilePos);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Enumerators;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Atmos.Reactions;
|
|||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Atmos;
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
|
|
||||||
tile.Clear();
|
tile.Clear();
|
||||||
var mixtureId = 0;
|
var mixtureId = 0;
|
||||||
foreach (var entUid in gridComp.Grid.GetAnchoredEntities(indices))
|
foreach (var entUid in gridComp.GetAnchoredEntities(indices))
|
||||||
{
|
{
|
||||||
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
|
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
|
|||||||
using Content.Server.Atmos.Reactions;
|
using Content.Server.Atmos.Reactions;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
@@ -53,7 +54,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
tile.GridIndex = uid;
|
tile.GridIndex = uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRepopulateTiles(mapGrid.Grid, gridAtmosphere);
|
GridRepopulateTiles(mapGrid, gridAtmosphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGridSplit(EntityUid uid, GridAtmosphereComponent originalGridAtmos, ref GridSplitEvent args)
|
private void OnGridSplit(EntityUid uid, GridAtmosphereComponent originalGridAtmos, ref GridSplitEvent args)
|
||||||
@@ -230,7 +231,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
|
|
||||||
var directions = AtmosDirection.Invalid;
|
var directions = AtmosDirection.Invalid;
|
||||||
|
|
||||||
var enumerator = GetObstructingComponentsEnumerator(mapGridComp.Grid, args.Tile);
|
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, args.Tile);
|
||||||
|
|
||||||
while (enumerator.MoveNext(out var obstructingComponent))
|
while (enumerator.MoveNext(out var obstructingComponent))
|
||||||
{
|
{
|
||||||
@@ -332,7 +333,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tile.AdjacentBits = AtmosDirection.Invalid;
|
tile.AdjacentBits = AtmosDirection.Invalid;
|
||||||
tile.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, tile.GridIndices);
|
tile.BlockedAirflow = GetBlockedDirections(mapGridComp, tile.GridIndices);
|
||||||
|
|
||||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||||
{
|
{
|
||||||
@@ -349,7 +350,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
|
|
||||||
var oppositeDirection = direction.GetOpposite();
|
var oppositeDirection = direction.GetOpposite();
|
||||||
|
|
||||||
adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp.Grid, adjacent.GridIndices);
|
adjacent.BlockedAirflow = GetBlockedDirections(mapGridComp, adjacent.GridIndices);
|
||||||
|
|
||||||
// Pass in MapGridComponent so we don't have to resolve it for every adjacent direction.
|
// Pass in MapGridComponent so we don't have to resolve it for every adjacent direction.
|
||||||
var tileBlockedEv = new IsTileAirBlockedMethodEvent(uid, tile.GridIndices, direction, mapGridComp);
|
var tileBlockedEv = new IsTileAirBlockedMethodEvent(uid, tile.GridIndices, direction, mapGridComp);
|
||||||
@@ -456,7 +457,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
|
|
||||||
tile.Air = new GasMixture
|
tile.Air = new GasMixture
|
||||||
{
|
{
|
||||||
Volume = GetVolumeForTiles(mapGridComp.Grid, 1),
|
Volume = GetVolumeForTiles(mapGridComp, 1),
|
||||||
Temperature = Atmospherics.T20C
|
Temperature = Atmospherics.T20C
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -533,7 +534,7 @@ public sealed partial class AtmosphereSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapGrid">The grid where to get all valid tiles from.</param>
|
/// <param name="mapGrid">The grid where to get all valid tiles from.</param>
|
||||||
/// <param name="gridAtmosphere">The grid atmosphere where the tiles will be repopulated.</param>
|
/// <param name="gridAtmosphere">The grid atmosphere where the tiles will be repopulated.</param>
|
||||||
private void GridRepopulateTiles(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere)
|
private void GridRepopulateTiles(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere)
|
||||||
{
|
{
|
||||||
var volume = GetVolumeForTiles(mapGrid, 1);
|
var volume = GetVolumeForTiles(mapGrid, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Shared.Physics.Components;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems
|
namespace Content.Server.Atmos.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
private readonly TileAtmosphere[] _depressurizeSpaceTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit];
|
private readonly TileAtmosphere[] _depressurizeSpaceTiles = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit];
|
||||||
private readonly TileAtmosphere[] _depressurizeProgressionOrder = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit * 2];
|
private readonly TileAtmosphere[] _depressurizeProgressionOrder = new TileAtmosphere[Atmospherics.MonstermosHardTileLimit * 2];
|
||||||
|
|
||||||
private void EqualizePressureInZone(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
|
private void EqualizePressureInZone(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
|
||||||
{
|
{
|
||||||
if (tile.Air == null || (tile.MonstermosInfo.LastCycle >= cycleNum))
|
if (tile.Air == null || (tile.MonstermosInfo.LastCycle >= cycleNum))
|
||||||
return; // Already done.
|
return; // Already done.
|
||||||
@@ -354,7 +355,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
Array.Clear(_equalizeQueue, 0, Atmospherics.MonstermosTileLimit);
|
Array.Clear(_equalizeQueue, 0, Atmospherics.MonstermosTileLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExplosivelyDepressurize(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
|
private void ExplosivelyDepressurize(MapGridComponent mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile, int cycleNum)
|
||||||
{
|
{
|
||||||
// Check if explosive depressurization is enabled and if the tile is valid.
|
// Check if explosive depressurization is enabled and if the tile is valid.
|
||||||
if (!MonstermosDepressurization || tile.Air == null)
|
if (!MonstermosDepressurization || tile.Air == null)
|
||||||
@@ -603,7 +604,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
adj.MonstermosInfo[direction.GetOpposite()] -= amount;
|
adj.MonstermosInfo[direction.GetOpposite()] -= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDecompressionFloorRip(IMapGrid mapGrid, TileAtmosphere tile, float sum)
|
private void HandleDecompressionFloorRip(MapGridComponent mapGrid, TileAtmosphere tile, float sum)
|
||||||
{
|
{
|
||||||
if (!MonstermosRipTiles)
|
if (!MonstermosRipTiles)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Piping.Components;
|
|||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -48,17 +49,16 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var mapGrid = mapGridComp.Grid;
|
|
||||||
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
|
var mapUid = _mapManager.GetMapEntityIdOrThrow(Transform(mapGridComp.Owner).MapID);
|
||||||
|
|
||||||
var volume = GetVolumeForTiles(mapGrid, 1);
|
var volume = GetVolumeForTiles(mapGridComp, 1);
|
||||||
|
|
||||||
var number = 0;
|
var number = 0;
|
||||||
while (atmosphere.CurrentRunInvalidatedCoordinates.TryDequeue(out var indices))
|
while (atmosphere.CurrentRunInvalidatedCoordinates.TryDequeue(out var indices))
|
||||||
{
|
{
|
||||||
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
|
if (!atmosphere.Tiles.TryGetValue(indices, out var tile))
|
||||||
{
|
{
|
||||||
tile = new TileAtmosphere(mapGrid.GridEntityId, indices,
|
tile = new TileAtmosphere(mapGridComp.GridEntityId, indices,
|
||||||
new GasMixture(volume) { Temperature = Atmospherics.T20C });
|
new GasMixture(volume) { Temperature = Atmospherics.T20C });
|
||||||
atmosphere.Tiles[indices] = tile;
|
atmosphere.Tiles[indices] = tile;
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call this instead of the grid method as the map has a say on whether the tile is space or not.
|
// Call this instead of the grid method as the map has a say on whether the tile is space or not.
|
||||||
if ((!mapGrid.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
|
if ((!mapGridComp.TryGetTileRef(indices, out var t) || t.IsSpace(_tileDefinitionManager)) && !isAirBlocked)
|
||||||
{
|
{
|
||||||
tile.Air = GetTileMixture(null, mapUid, indices);
|
tile.Air = GetTileMixture(null, mapUid, indices);
|
||||||
tile.MolesArchived = tile.Air != null ? new float[Atmospherics.AdjustedNumberOfGases] : null;
|
tile.MolesArchived = tile.Air != null ? new float[Atmospherics.AdjustedNumberOfGases] : null;
|
||||||
@@ -87,7 +87,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
var nullAir = false;
|
var nullAir = false;
|
||||||
|
|
||||||
var enumerator = GetObstructingComponentsEnumerator(mapGrid, indices);
|
var enumerator = GetObstructingComponentsEnumerator(mapGridComp, indices);
|
||||||
|
|
||||||
while (enumerator.MoveNext(out var airtight))
|
while (enumerator.MoveNext(out var airtight))
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tile.Air == null && NeedsVacuumFixing(mapGrid, indices))
|
if (tile.Air == null && NeedsVacuumFixing(mapGridComp, indices))
|
||||||
{
|
{
|
||||||
var vacuumEv = new FixTileVacuumMethodEvent(uid, indices);
|
var vacuumEv = new FixTileVacuumMethodEvent(uid, indices);
|
||||||
GridFixTileVacuum(uid, atmosphere, ref vacuumEv);
|
GridFixTileVacuum(uid, atmosphere, ref vacuumEv);
|
||||||
@@ -133,12 +133,12 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
AddActiveTile(atmosphere, tile);
|
AddActiveTile(atmosphere, tile);
|
||||||
|
|
||||||
// TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity and heat capacity
|
// TODO ATMOS: Query all the contents of this tile (like walls) and calculate the correct thermal conductivity and heat capacity
|
||||||
var tileDef = mapGrid.TryGetTileRef(indices, out var tileRef)
|
var tileDef = mapGridComp.TryGetTileRef(indices, out var tileRef)
|
||||||
? tileRef.GetContentTileDefinition(_tileDefinitionManager) : null;
|
? tileRef.GetContentTileDefinition(_tileDefinitionManager) : null;
|
||||||
|
|
||||||
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
|
tile.ThermalConductivity = tileDef?.ThermalConductivity ?? 0.5f;
|
||||||
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
|
tile.HeatCapacity = tileDef?.HeatCapacity ?? float.PositiveInfinity;
|
||||||
InvalidateVisuals(mapGrid.GridEntityId, indices);
|
InvalidateVisuals(mapGridComp.GridEntityId, indices);
|
||||||
|
|
||||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||||
{
|
{
|
||||||
@@ -171,12 +171,10 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
if (!TryComp(uid, out MapGridComponent? mapGridComp))
|
||||||
throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!");
|
throw new Exception("Tried to process a grid atmosphere on an entity that isn't a grid!");
|
||||||
|
|
||||||
var mapGrid = mapGridComp.Grid;
|
|
||||||
|
|
||||||
var number = 0;
|
var number = 0;
|
||||||
while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
|
while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
|
||||||
{
|
{
|
||||||
EqualizePressureInZone(mapGrid, atmosphere, tile, atmosphere.UpdateCounter);
|
EqualizePressureInZone(mapGridComp, atmosphere, tile, atmosphere.UpdateCounter);
|
||||||
|
|
||||||
if (number++ < LagCheckIterations) continue;
|
if (number++ < LagCheckIterations) continue;
|
||||||
number = 0;
|
number = 0;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.Components;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ public partial class AtmosphereSystem
|
|||||||
_gasTileOverlaySystem.Invalidate(gridUid, tile);
|
_gasTileOverlaySystem.Invalidate(gridUid, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool NeedsVacuumFixing(IMapGrid mapGrid, Vector2i indices)
|
public bool NeedsVacuumFixing(MapGridComponent mapGrid, Vector2i indices)
|
||||||
{
|
{
|
||||||
var value = false;
|
var value = false;
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ public partial class AtmosphereSystem
|
|||||||
/// <param name="mapGrid">The grid in question.</param>
|
/// <param name="mapGrid">The grid in question.</param>
|
||||||
/// <param name="tiles">The amount of tiles.</param>
|
/// <param name="tiles">The amount of tiles.</param>
|
||||||
/// <returns>The volume in liters that the tiles occupy.</returns>
|
/// <returns>The volume in liters that the tiles occupy.</returns>
|
||||||
private float GetVolumeForTiles(IMapGrid mapGrid, int tiles = 1)
|
private float GetVolumeForTiles(MapGridComponent mapGrid, int tiles = 1)
|
||||||
{
|
{
|
||||||
return Atmospherics.CellVolume * mapGrid.TileSize * tiles;
|
return Atmospherics.CellVolume * mapGrid.TileSize * tiles;
|
||||||
}
|
}
|
||||||
@@ -69,7 +70,7 @@ public partial class AtmosphereSystem
|
|||||||
/// <param name="mapGrid">The grid where to get the tile.</param>
|
/// <param name="mapGrid">The grid where to get the tile.</param>
|
||||||
/// <param name="tile">The indices of the tile.</param>
|
/// <param name="tile">The indices of the tile.</param>
|
||||||
/// <returns>The enumerator for the airtight components.</returns>
|
/// <returns>The enumerator for the airtight components.</returns>
|
||||||
public AtmosObstructionEnumerator GetObstructingComponentsEnumerator(IMapGrid mapGrid, Vector2i tile)
|
public AtmosObstructionEnumerator GetObstructingComponentsEnumerator(MapGridComponent mapGrid, Vector2i tile)
|
||||||
{
|
{
|
||||||
var ancEnumerator = mapGrid.GetAnchoredEntitiesEnumerator(tile);
|
var ancEnumerator = mapGrid.GetAnchoredEntitiesEnumerator(tile);
|
||||||
var airQuery = GetEntityQuery<AirtightComponent>();
|
var airQuery = GetEntityQuery<AirtightComponent>();
|
||||||
@@ -78,7 +79,7 @@ public partial class AtmosphereSystem
|
|||||||
return enumerator;
|
return enumerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AtmosDirection GetBlockedDirections(IMapGrid mapGrid, Vector2i indices)
|
private AtmosDirection GetBlockedDirections(MapGridComponent mapGrid, Vector2i indices)
|
||||||
{
|
{
|
||||||
var value = AtmosDirection.Invalid;
|
var value = AtmosDirection.Invalid;
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ public partial class AtmosphereSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mapGrid">The grid in question.</param>
|
/// <param name="mapGrid">The grid in question.</param>
|
||||||
/// <param name="tile">The indices of the tile.</param>
|
/// <param name="tile">The indices of the tile.</param>
|
||||||
private void PryTile(IMapGrid mapGrid, Vector2i tile)
|
private void PryTile(MapGridComponent mapGrid, Vector2i tile)
|
||||||
{
|
{
|
||||||
if (!mapGrid.TryGetTileRef(tile, out var tileRef))
|
if (!mapGrid.TryGetTileRef(tile, out var tileRef))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Robust.Server.Maps;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -405,7 +406,7 @@ public sealed partial class CargoSystem
|
|||||||
var offset = 0f;
|
var offset = 0f;
|
||||||
if (TryComp<MapGridComponent>(orderDatabase.Shuttle, out var shuttleGrid))
|
if (TryComp<MapGridComponent>(orderDatabase.Shuttle, out var shuttleGrid))
|
||||||
{
|
{
|
||||||
var bounds = shuttleGrid.Grid.LocalAABB;
|
var bounds = shuttleGrid.LocalAABB;
|
||||||
offset = MathF.Max(bounds.Width, bounds.Height) / 2f;
|
offset = MathF.Max(bounds.Width, bounds.Height) / 2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Chemistry.Components;
|
|||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -73,8 +74,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
if (!_entities.TryGetComponent(xform.GridUid, out MapGridComponent? gridComp))
|
if (!_entities.TryGetComponent(xform.GridUid, out MapGridComponent? gridComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var grid = gridComp.Grid;
|
var origin = gridComp.TileIndicesFor(xform.Coordinates);
|
||||||
var origin = grid.TileIndicesFor(xform.Coordinates);
|
|
||||||
|
|
||||||
DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
|
DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
|
||||||
|
|
||||||
@@ -82,10 +82,10 @@ namespace Content.Server.Chemistry.Components
|
|||||||
{
|
{
|
||||||
// Currently no support for spreading off or across grids.
|
// Currently no support for spreading off or across grids.
|
||||||
var index = origin + dir.ToIntVec();
|
var index = origin + dir.ToIntVec();
|
||||||
if (!grid.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
|
if (!gridComp.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var neighbor in grid.GetAnchoredEntities(index))
|
foreach (var neighbor in gridComp.GetAnchoredEntities(index))
|
||||||
{
|
{
|
||||||
if (_entities.TryGetComponent(neighbor,
|
if (_entities.TryGetComponent(neighbor,
|
||||||
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
|
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
|
||||||
@@ -100,7 +100,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
var newEffect = _entities.SpawnEntity(
|
var newEffect = _entities.SpawnEntity(
|
||||||
meta.EntityPrototype.ID,
|
meta.EntityPrototype.ID,
|
||||||
grid.GridTileToLocal(index));
|
gridComp.GridTileToLocal(index));
|
||||||
|
|
||||||
if (!_entities.TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent))
|
if (!_entities.TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Throwing;
|
|||||||
using Content.Shared.Vapor;
|
using Content.Shared.Vapor;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
@@ -109,7 +110,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
{
|
{
|
||||||
vapor.ReactTimer = 0;
|
vapor.ReactTimer = 0;
|
||||||
|
|
||||||
var tile = gridComp.Grid.GetTileRef(xform.Coordinates.ToVector2i(EntityManager, _mapManager));
|
var tile = gridComp.GetTileRef(xform.Coordinates.ToVector2i(EntityManager, _mapManager));
|
||||||
foreach (var reagentQuantity in contents.Contents.ToArray())
|
foreach (var reagentQuantity in contents.Contents.ToArray())
|
||||||
{
|
{
|
||||||
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;
|
if (reagentQuantity.Quantity == FixedPoint2.Zero) continue;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Coordinates.Helpers
|
namespace Content.Server.Coordinates.Helpers
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ namespace Content.Server.Coordinates.Helpers
|
|||||||
return new EntityCoordinates(coordinates.EntityId, x, y);
|
return new EntityCoordinates(coordinates.EntityId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IMapGrid grid)
|
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, MapGridComponent grid)
|
||||||
{
|
{
|
||||||
var tileSize = grid.TileSize;
|
var tileSize = grid.TileSize;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -515,7 +516,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var coords = xform.Coordinates;
|
var coords = xform.Coordinates;
|
||||||
var entry = grid.Grid.GetLocal(coords)
|
var entry = grid.GetLocal(coords)
|
||||||
.FirstOrDefault(entity => EntityManager.HasComponent<DisposalEntryComponent>(entity));
|
.FirstOrDefault(entity => EntityManager.HasComponent<DisposalEntryComponent>(entity));
|
||||||
|
|
||||||
if (entry == default)
|
if (entry == default)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Content.Shared.Doors.Components;
|
|||||||
using Content.Shared.Doors.Systems;
|
using Content.Shared.Doors.Systems;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Doors.Systems
|
namespace Content.Server.Doors.Systems
|
||||||
@@ -233,7 +234,7 @@ namespace Content.Server.Doors.Systems
|
|||||||
if (!TryComp(xform.ParentUid, out GridAtmosphereComponent? gridAtmosphere))
|
if (!TryComp(xform.ParentUid, out GridAtmosphereComponent? gridAtmosphere))
|
||||||
return (false, false);
|
return (false, false);
|
||||||
|
|
||||||
var grid = Comp<MapGridComponent>(xform.ParentUid).Grid;
|
var grid = Comp<MapGridComponent>(xform.ParentUid);
|
||||||
var pos = grid.CoordinatesToTile(xform.Coordinates);
|
var pos = grid.CoordinatesToTile(xform.Coordinates);
|
||||||
var minPressure = float.MaxValue;
|
var minPressure = float.MaxValue;
|
||||||
var maxPressure = float.MinValue;
|
var maxPressure = float.MinValue;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.GameTicking;
|
|||||||
using Content.Server.StationEvents.Components;
|
using Content.Server.StationEvents.Components;
|
||||||
using Content.Shared.Dragon;
|
using Content.Shared.Dragon;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Dragon;
|
namespace Content.Server.Dragon;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Electrocution
|
namespace Content.Server.Electrocution
|
||||||
{
|
{
|
||||||
@@ -15,7 +16,7 @@ namespace Content.Server.Electrocution
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!nodeQuery.TryGetComponent(CableEntity, out var nodeContainer))
|
if (!nodeQuery.TryGetComponent(CableEntity, out var nodeContainer))
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using static Content.Server.Explosion.EntitySystems.ExplosionSystem;
|
using static Content.Server.Explosion.EntitySystems.ExplosionSystem;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.EntitySystems;
|
namespace Content.Server.Explosion.EntitySystems;
|
||||||
@@ -9,7 +10,7 @@ namespace Content.Server.Explosion.EntitySystems;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
||||||
{
|
{
|
||||||
public IMapGrid Grid;
|
public MapGridComponent Grid;
|
||||||
private bool _needToTransform = false;
|
private bool _needToTransform = false;
|
||||||
|
|
||||||
private Matrix3 _matrix = Matrix3.Identity;
|
private Matrix3 _matrix = Matrix3.Identity;
|
||||||
@@ -35,7 +36,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
private Dictionary<Vector2i, NeighborFlag> _edgeTiles;
|
private Dictionary<Vector2i, NeighborFlag> _edgeTiles;
|
||||||
|
|
||||||
public ExplosionGridTileFlood(
|
public ExplosionGridTileFlood(
|
||||||
IMapGrid grid,
|
MapGridComponent grid,
|
||||||
Dictionary<Vector2i, TileData> airtightMap,
|
Dictionary<Vector2i, TileData> airtightMap,
|
||||||
float maxIntensity,
|
float maxIntensity,
|
||||||
float intensityStepSize,
|
float intensityStepSize,
|
||||||
@@ -179,7 +180,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
if (EnteredBlockedTiles.Contains(tile))
|
if (EnteredBlockedTiles.Contains(tile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Did the explosion already attempt to enter this tile from some other direction?
|
// Did the explosion already attempt to enter this tile from some other direction?
|
||||||
if (!UnenteredBlockedTiles.Add(tile))
|
if (!UnenteredBlockedTiles.Add(tile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
|||||||
if (!EnteredBlockedTiles.Add(tile))
|
if (!EnteredBlockedTiles.Add(tile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Did the explosion already attempt to enter this tile from some other direction?
|
// Did the explosion already attempt to enter this tile from some other direction?
|
||||||
if (UnenteredBlockedTiles.Contains(tile))
|
if (UnenteredBlockedTiles.Contains(tile))
|
||||||
{
|
{
|
||||||
NewFreedTiles.Add(tile);
|
NewFreedTiles.Add(tile);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Damage;
|
|||||||
using Content.Shared.Explosion;
|
using Content.Shared.Explosion;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.EntitySystems;
|
namespace Content.Server.Explosion.EntitySystems;
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
/// something like a normal and a reinforced windoor on the same tile. But given that this is a pretty rare
|
/// something like a normal and a reinforced windoor on the same tile. But given that this is a pretty rare
|
||||||
/// occurrence, I am fine with this.
|
/// occurrence, I am fine with this.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void UpdateAirtightMap(IMapGrid grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
|
public void UpdateAirtightMap(MapGridComponent grid, Vector2i tile, EntityQuery<AirtightComponent>? query = null)
|
||||||
{
|
{
|
||||||
var tolerance = new float[_explosionTypes.Count];
|
var tolerance = new float[_explosionTypes.Count];
|
||||||
var blockedDirections = AtmosDirection.Invalid;
|
var blockedDirections = AtmosDirection.Invalid;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.EntitySystems;
|
namespace Content.Server.Explosion.EntitySystems;
|
||||||
|
|
||||||
// This partial part of the explosion system has all of the functions used to facilitate explosions moving across grids.
|
// This partial part of the explosion system has all of the functions used to facilitate explosions moving across grids.
|
||||||
@@ -289,7 +291,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
/// Optionally ignore a specific Vector2i. Used by <see cref="OnTileChanged"/> when we already know that a
|
/// Optionally ignore a specific Vector2i. Used by <see cref="OnTileChanged"/> when we already know that a
|
||||||
/// given tile is not space. This avoids unnecessary TryGetTileRef calls.
|
/// given tile is not space. This avoids unnecessary TryGetTileRef calls.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private bool IsEdge(IMapGrid grid, Vector2i index, out NeighborFlag spaceDirections)
|
private bool IsEdge(MapGridComponent grid, Vector2i index, out NeighborFlag spaceDirections)
|
||||||
{
|
{
|
||||||
spaceDirections = NeighborFlag.Invalid;
|
spaceDirections = NeighborFlag.Invalid;
|
||||||
for (var i = 0; i < NeighbourVectors.Length; i++)
|
for (var i = 0; i < NeighbourVectors.Length; i++)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Explosion;
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
@@ -194,7 +195,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if the underlying tile can be uprooted, false if the tile is blocked by a dense entity</returns>
|
/// <returns>True if the underlying tile can be uprooted, false if the tile is blocked by a dense entity</returns>
|
||||||
internal bool ExplodeTile(BroadphaseComponent lookup,
|
internal bool ExplodeTile(BroadphaseComponent lookup,
|
||||||
IMapGrid grid,
|
MapGridComponent grid,
|
||||||
Vector2i tile,
|
Vector2i tile,
|
||||||
float throwForce,
|
float throwForce,
|
||||||
DamageSpecifier damage,
|
DamageSpecifier damage,
|
||||||
@@ -494,7 +495,7 @@ sealed class Explosion
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The actual grid that this corresponds to. If null, this implies space.
|
/// The actual grid that this corresponds to. If null, this implies space.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IMapGrid? MapGrid;
|
public MapGridComponent? MapGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<ExplosionData> _explosionData = new();
|
private readonly List<ExplosionData> _explosionData = new();
|
||||||
@@ -543,7 +544,7 @@ sealed class Explosion
|
|||||||
// Variables used for enumerating over tiles, grids, etc
|
// Variables used for enumerating over tiles, grids, etc
|
||||||
private DamageSpecifier _currentDamage = default!;
|
private DamageSpecifier _currentDamage = default!;
|
||||||
private BroadphaseComponent _currentLookup = default!;
|
private BroadphaseComponent _currentLookup = default!;
|
||||||
private IMapGrid? _currentGrid;
|
private MapGridComponent? _currentGrid;
|
||||||
private float _currentIntensity;
|
private float _currentIntensity;
|
||||||
private float _currentThrowForce;
|
private float _currentThrowForce;
|
||||||
private List<Vector2i>.Enumerator _currentEnumerator;
|
private List<Vector2i>.Enumerator _currentEnumerator;
|
||||||
@@ -553,7 +554,7 @@ sealed class Explosion
|
|||||||
/// The set of tiles that need to be updated when the explosion has finished processing. Used to avoid having
|
/// The set of tiles that need to be updated when the explosion has finished processing. Used to avoid having
|
||||||
/// the explosion trigger chunk regeneration & shuttle-system processing every tick.
|
/// the explosion trigger chunk regeneration & shuttle-system processing every tick.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<IMapGrid, List<(Vector2i, Tile)>> _tileUpdateDict = new();
|
private readonly Dictionary<MapGridComponent, List<(Vector2i, Tile)>> _tileUpdateDict = new();
|
||||||
|
|
||||||
// Entity Queries
|
// Entity Queries
|
||||||
private readonly EntityQuery<TransformComponent> _xformQuery;
|
private readonly EntityQuery<TransformComponent> _xformQuery;
|
||||||
@@ -642,7 +643,7 @@ sealed class Explosion
|
|||||||
_explosionData.Add(new()
|
_explosionData.Add(new()
|
||||||
{
|
{
|
||||||
TileLists = grid.TileLists,
|
TileLists = grid.TileLists,
|
||||||
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.GridEntityId),
|
Lookup = entMan.GetComponent<BroadphaseComponent>(grid.Grid.Owner),
|
||||||
MapGrid = grid.Grid
|
MapGrid = grid.Grid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
|
Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
|
||||||
foreach (var grid in gridData)
|
foreach (var grid in gridData)
|
||||||
{
|
{
|
||||||
tileLists.Add(grid.Grid.GridEntityId, grid.TileLists);
|
tileLists.Add(grid.Grid.Owner, grid.TileLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ExplosionEvent(_explosionCounter, epicenter, id, iterationIntensity, spaceTiles, tileLists, spaceMatrix, spaceData?.TileSize ?? DefaultTileSize);
|
return new ExplosionEvent(_explosionCounter, epicenter, id, iterationIntensity, spaceTiles, tileLists, spaceMatrix, spaceData?.TileSize ?? DefaultTileSize);
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ using Content.Shared.Directions;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -101,7 +104,7 @@ public sealed class FluidSpreaderSystem : EntitySystem
|
|||||||
/// <param name="mapGrid">helper param needed to extract entities</param>
|
/// <param name="mapGrid">helper param needed to extract entities</param>
|
||||||
/// <param name="puddle">either found or newly created PuddleComponent.</param>
|
/// <param name="puddle">either found or newly created PuddleComponent.</param>
|
||||||
/// <returns>true if tile is empty or occupied by a non-overflowing puddle (or a puddle close to being overflowing)</returns>
|
/// <returns>true if tile is empty or occupied by a non-overflowing puddle (or a puddle close to being overflowing)</returns>
|
||||||
private bool CheckTile(EntityUid srcUid, PuddleComponent srcPuddle, EntityCoordinates pos, IMapGrid mapGrid,
|
private bool CheckTile(EntityUid srcUid, PuddleComponent srcPuddle, EntityCoordinates pos, MapGridComponent mapGrid,
|
||||||
[NotNullWhen(true)] out PuddleComponent? puddle)
|
[NotNullWhen(true)] out PuddleComponent? puddle)
|
||||||
{
|
{
|
||||||
if (!mapGrid.TryGetTileRef(pos, out var tileRef)
|
if (!mapGrid.TryGetTileRef(pos, out var tileRef)
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem
|
|||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
|
|
||||||
var aabbs = _stationSystem.Stations.SelectMany(x =>
|
var aabbs = _stationSystem.Stations.SelectMany(x =>
|
||||||
Comp<StationDataComponent>(x).Grids.Select(x => xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).Grid.LocalAABB))).ToArray();
|
Comp<StationDataComponent>(x).Grids.Select(x => xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB))).ToArray();
|
||||||
|
|
||||||
var aabb = aabbs[0];
|
var aabb = aabbs[0];
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -215,7 +216,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
|
|||||||
foreach (var (_, mapGrid) in EntityManager.EntityQuery<StationMemberComponent, MapGridComponent>(true))
|
foreach (var (_, mapGrid) in EntityManager.EntityQuery<StationMemberComponent, MapGridComponent>(true))
|
||||||
{
|
{
|
||||||
// I'm so sorry.
|
// I'm so sorry.
|
||||||
var tiles = mapGrid.Grid.GetAllTiles().ToArray();
|
var tiles = mapGrid.GetAllTiles().ToArray();
|
||||||
Logger.Info($"TILES: {tiles.Length}");
|
Logger.Info($"TILES: {tiles.Length}");
|
||||||
|
|
||||||
var spawn = susLoot.GetSpawns();
|
var spawn = susLoot.GetSpawns();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Physics;
|
|||||||
using Microsoft.Extensions.ObjectPool;
|
using Microsoft.Extensions.ObjectPool;
|
||||||
using Robust.Shared.Collections;
|
using Robust.Shared.Collections;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
@@ -140,7 +141,7 @@ public sealed partial class PathfindingSystem
|
|||||||
var fixturesQuery = GetEntityQuery<FixturesComponent>();
|
var fixturesQuery = GetEntityQuery<FixturesComponent>();
|
||||||
var physicsQuery = GetEntityQuery<PhysicsComponent>();
|
var physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
|
BuildBreadcrumbs(dirt[i], mapGridComp, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int Division = 4;
|
const int Division = 4;
|
||||||
@@ -361,7 +362,7 @@ public sealed partial class PathfindingSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void BuildBreadcrumbs(GridPathfindingChunk chunk,
|
private void BuildBreadcrumbs(GridPathfindingChunk chunk,
|
||||||
IMapGrid grid,
|
MapGridComponent grid,
|
||||||
EntityQuery<AccessReaderComponent> accessQuery,
|
EntityQuery<AccessReaderComponent> accessQuery,
|
||||||
EntityQuery<DestructibleComponent> destructibleQuery,
|
EntityQuery<DestructibleComponent> destructibleQuery,
|
||||||
EntityQuery<DoorComponent> doorQuery,
|
EntityQuery<DoorComponent> doorQuery,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
{
|
{
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer.EntitySystems;
|
using Content.Server.NodeContainer.EntitySystems;
|
||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
{
|
{
|
||||||
@@ -97,7 +98,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
public abstract IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public abstract IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan);
|
IEntityManager entMan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
{
|
{
|
||||||
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class NodeHelpers
|
public static class NodeHelpers
|
||||||
{
|
{
|
||||||
public static IEnumerable<Node> GetNodesInTile(EntityQuery<NodeContainerComponent> nodeQuery, IMapGrid grid, Vector2i coords)
|
public static IEnumerable<Node> GetNodesInTile(EntityQuery<NodeContainerComponent> nodeQuery, MapGridComponent grid, Vector2i coords)
|
||||||
{
|
{
|
||||||
foreach (var entityUid in grid.GetAnchoredEntities(coords))
|
foreach (var entityUid in grid.GetAnchoredEntities(coords))
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
|
|
||||||
public static IEnumerable<(Direction dir, Node node)> GetCardinalNeighborNodes(
|
public static IEnumerable<(Direction dir, Node node)> GetCardinalNeighborNodes(
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
IMapGrid grid,
|
MapGridComponent grid,
|
||||||
Vector2i coords,
|
Vector2i coords,
|
||||||
bool includeSameTile = true)
|
bool includeSameTile = true)
|
||||||
{
|
{
|
||||||
@@ -42,7 +43,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
|
|
||||||
[SuppressMessage("ReSharper", "EnforceForeachStatementBraces")]
|
[SuppressMessage("ReSharper", "EnforceForeachStatementBraces")]
|
||||||
public static IEnumerable<(Direction dir, EntityUid entity)> GetCardinalNeighborCells(
|
public static IEnumerable<(Direction dir, EntityUid entity)> GetCardinalNeighborCells(
|
||||||
IMapGrid grid,
|
MapGridComponent grid,
|
||||||
Vector2i coords,
|
Vector2i coords,
|
||||||
bool includeSameTile = true)
|
bool includeSameTile = true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.NodeContainer.EntitySystems;
|
|||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
@@ -152,7 +153,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (_alwaysReachable != null)
|
if (_alwaysReachable != null)
|
||||||
@@ -195,7 +196,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the pipes that can connect to us from entities on the tile or adjacent in a direction.
|
/// Gets the pipes that can connect to us from entities on the tile or adjacent in a direction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IEnumerable<PipeNode> LinkableNodesInDirection(Vector2i pos, PipeDirection pipeDir, IMapGrid grid,
|
private IEnumerable<PipeNode> LinkableNodesInDirection(Vector2i pos, PipeDirection pipeDir, MapGridComponent grid,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery)
|
EntityQuery<NodeContainerComponent> nodeQuery)
|
||||||
{
|
{
|
||||||
foreach (var pipe in PipesInDirection(pos, pipeDir, grid, nodeQuery))
|
foreach (var pipe in PipesInDirection(pos, pipeDir, grid, nodeQuery))
|
||||||
@@ -211,7 +212,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the pipes from entities on the tile adjacent in a direction.
|
/// Gets the pipes from entities on the tile adjacent in a direction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IEnumerable<PipeNode> PipesInDirection(Vector2i pos, PipeDirection pipeDir, IMapGrid grid,
|
protected IEnumerable<PipeNode> PipesInDirection(Vector2i pos, PipeDirection pipeDir, MapGridComponent grid,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery)
|
EntityQuery<NodeContainerComponent> nodeQuery)
|
||||||
{
|
{
|
||||||
var offsetPos = pos.Offset(pipeDir.ToDirection());
|
var offsetPos = pos.Offset(pipeDir.ToDirection());
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
{
|
{
|
||||||
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.NodeContainer.Nodes
|
namespace Content.Server.NodeContainer.Nodes
|
||||||
{
|
{
|
||||||
@@ -8,7 +9,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.Cuffs.Components;
|
|||||||
using Content.Server.Objectives.Interfaces;
|
using Content.Server.Objectives.Interfaces;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Objectives.Conditions
|
namespace Content.Server.Objectives.Conditions
|
||||||
@@ -38,7 +39,7 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return shuttleXform.WorldMatrix.TransformBox(shuttleGrid.Grid.LocalAABB).Contains(agentXform.WorldPosition);
|
return shuttleXform.WorldMatrix.TransformBox(shuttleGrid.LocalAABB).Contains(agentXform.WorldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Progress
|
public float Progress
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Singularity.Components;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
// using static Content.Shared.Wires.SharedWiresComponent;
|
// using static Content.Shared.Wires.SharedWiresComponent;
|
||||||
using Timer = Robust.Shared.Timing.Timer;
|
using Timer = Robust.Shared.Timing.Timer;
|
||||||
@@ -344,7 +345,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
// Find fuel chamber first by scanning cardinals.
|
// Find fuel chamber first by scanning cardinals.
|
||||||
if (xform.Anchored && _entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid))
|
if (xform.Anchored && _entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid))
|
||||||
{
|
{
|
||||||
foreach (var maybeFuel in grid.Grid.GetCardinalNeighborCells(xform.Coordinates))
|
foreach (var maybeFuel in grid.GetCardinalNeighborCells(xform.Coordinates))
|
||||||
{
|
{
|
||||||
if (_entMan.TryGetComponent(maybeFuel, out _partFuelChamber))
|
if (_entMan.TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Power.Nodes
|
namespace Content.Server.Power.Nodes
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,7 @@ namespace Content.Server.Power.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Power.Nodes
|
namespace Content.Server.Power.Nodes
|
||||||
{
|
{
|
||||||
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Power.Nodes
|
namespace Content.Server.Power.Nodes
|
||||||
{
|
{
|
||||||
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Power.Nodes
|
namespace Content.Server.Power.Nodes
|
||||||
{
|
{
|
||||||
@@ -10,7 +11,7 @@ namespace Content.Server.Power.Nodes
|
|||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||||
EntityQuery<TransformComponent> xformQuery,
|
EntityQuery<TransformComponent> xformQuery,
|
||||||
IMapGrid? grid,
|
MapGridComponent? grid,
|
||||||
IEntityManager entMan)
|
IEntityManager entMan)
|
||||||
{
|
{
|
||||||
if (!xform.Anchored || grid == null)
|
if (!xform.Anchored || grid == null)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.Maps;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.RCD.Systems
|
namespace Content.Server.RCD.Systems
|
||||||
@@ -155,7 +156,7 @@ namespace Content.Server.RCD.Systems
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsRCDStillValid(RCDComponent rcd, AfterInteractEvent eventArgs, IMapGrid mapGrid, TileRef tile, RcdMode startingMode)
|
private bool IsRCDStillValid(RCDComponent rcd, AfterInteractEvent eventArgs, MapGridComponent mapGrid, TileRef tile, RcdMode startingMode)
|
||||||
{
|
{
|
||||||
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
|
//Less expensive checks first. Failing those ones, we need to check that the tile isn't obstructed.
|
||||||
if (rcd.CurrentAmmo <= 0)
|
if (rcd.CurrentAmmo <= 0)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Radiation.Components;
|
using Content.Server.Radiation.Components;
|
||||||
using Content.Shared.Doors;
|
using Content.Shared.Doors;
|
||||||
using Content.Shared.Doors.Components;
|
using Content.Shared.Doors.Components;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Radiation.Systems;
|
namespace Content.Server.Radiation.Systems;
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ public partial class RadiationSystem
|
|||||||
|
|
||||||
// save resistance into rad protection grid
|
// save resistance into rad protection grid
|
||||||
var gridId = trs.GridUid.Value;
|
var gridId = trs.GridUid.Value;
|
||||||
var tilePos = grid.Grid.TileIndicesFor(trs.Coordinates);
|
var tilePos = grid.TileIndicesFor(trs.Coordinates);
|
||||||
AddToTile(gridId, tilePos, component.RadResistance);
|
AddToTile(gridId, tilePos, component.RadResistance);
|
||||||
|
|
||||||
// and remember it as last valid position
|
// and remember it as last valid position
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Radiation.Components;
|
|||||||
using Content.Shared.Radiation.Systems;
|
using Content.Shared.Radiation.Systems;
|
||||||
using Robust.Shared.Collections;
|
using Robust.Shared.Collections;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ public partial class RadiationSystem
|
|||||||
{
|
{
|
||||||
if (!gridQuery.TryGetComponent(sourceTrs.GridUid.Value, out var gridComponent))
|
if (!gridQuery.TryGetComponent(sourceTrs.GridUid.Value, out var gridComponent))
|
||||||
return ray;
|
return ray;
|
||||||
return Gridcast(gridComponent.Grid, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value));
|
return Gridcast(gridComponent, ray, saveVisitedTiles, resistanceQuery, sourceTrs, destTrs, transformQuery.GetComponent(sourceTrs.GridUid.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// lets check how many grids are between source and destination
|
// lets check how many grids are between source and destination
|
||||||
@@ -142,7 +143,7 @@ public partial class RadiationSystem
|
|||||||
return ray;
|
return ray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RadiationRay Gridcast(IMapGrid grid, RadiationRay ray, bool saveVisitedTiles,
|
private RadiationRay Gridcast(MapGridComponent grid, RadiationRay ray, bool saveVisitedTiles,
|
||||||
EntityQuery<RadiationGridResistanceComponent> resistanceQuery,
|
EntityQuery<RadiationGridResistanceComponent> resistanceQuery,
|
||||||
TransformComponent sourceTrs,
|
TransformComponent sourceTrs,
|
||||||
TransformComponent destTrs,
|
TransformComponent destTrs,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using Robust.Server.Player;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -115,7 +116,7 @@ public sealed partial class ShuttleSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool ValidSpawn(MapGridComponent grid, Box2 area)
|
private bool ValidSpawn(MapGridComponent grid, Box2 area)
|
||||||
{
|
{
|
||||||
return !grid.Grid.GetLocalTilesIntersecting(area).Any();
|
return !grid.GetLocalTilesIntersecting(area).Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
private DockingConfig? GetDockingConfig(ShuttleComponent component, EntityUid targetGrid)
|
private DockingConfig? GetDockingConfig(ShuttleComponent component, EntityUid targetGrid)
|
||||||
@@ -131,7 +132,7 @@ public sealed partial class ShuttleSystem
|
|||||||
var targetGridRotation = targetGridAngle.ToVec();
|
var targetGridRotation = targetGridAngle.ToVec();
|
||||||
|
|
||||||
var shuttleDocks = GetDocks(component.Owner);
|
var shuttleDocks = GetDocks(component.Owner);
|
||||||
var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
|
var shuttleAABB = Comp<MapGridComponent>(component.Owner).LocalAABB;
|
||||||
|
|
||||||
var validDockConfigs = new List<DockingConfig>();
|
var validDockConfigs = new List<DockingConfig>();
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Robust.Shared.Utility;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.Shuttles.Events;
|
using Content.Server.Shuttles.Events;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
|
||||||
namespace Content.Server.Shuttles.Systems;
|
namespace Content.Server.Shuttles.Systems;
|
||||||
@@ -95,7 +96,7 @@ public sealed partial class ShuttleSystem
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bounds = xform.WorldMatrix.TransformBox(grid.Grid.LocalAABB).Enlarged(ShuttleFTLRange);
|
var bounds = xform.WorldMatrix.TransformBox(grid.LocalAABB).Enlarged(ShuttleFTLRange);
|
||||||
var bodyQuery = GetEntityQuery<PhysicsComponent>();
|
var bodyQuery = GetEntityQuery<PhysicsComponent>();
|
||||||
|
|
||||||
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
|
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
|
||||||
@@ -226,7 +227,7 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
comp.State = FTLState.Travelling;
|
comp.State = FTLState.Travelling;
|
||||||
|
|
||||||
var width = Comp<MapGridComponent>(comp.Owner).Grid.LocalAABB.Width;
|
var width = Comp<MapGridComponent>(comp.Owner).LocalAABB.Width;
|
||||||
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
|
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
|
||||||
xform.LocalRotation = Angle.Zero;
|
xform.LocalRotation = Angle.Zero;
|
||||||
_index += width + Buffer;
|
_index += width + Buffer;
|
||||||
@@ -458,13 +459,13 @@ public sealed partial class ShuttleSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
|
var shuttleAABB = Comp<MapGridComponent>(component.Owner).LocalAABB;
|
||||||
|
|
||||||
// Spawn nearby.
|
// Spawn nearby.
|
||||||
// We essentially expand the Box2 of the target area until nothing else is added then we know it's valid.
|
// We essentially expand the Box2 of the target area until nothing else is added then we know it's valid.
|
||||||
// Can't just get an AABB of every grid as we may spawn very far away.
|
// Can't just get an AABB of every grid as we may spawn very far away.
|
||||||
var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery)
|
var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery)
|
||||||
.TransformBox(Comp<MapGridComponent>(targetUid).Grid.LocalAABB).Enlarged(shuttleAABB.Size.Length);
|
.TransformBox(Comp<MapGridComponent>(targetUid).LocalAABB).Enlarged(shuttleAABB.Size.Length);
|
||||||
|
|
||||||
var nearbyGrids = new HashSet<EntityUid>(1) { targetUid };
|
var nearbyGrids = new HashSet<EntityUid>(1) { targetUid };
|
||||||
var iteration = 0;
|
var iteration = 0;
|
||||||
@@ -478,7 +479,7 @@ public sealed partial class ShuttleSystem
|
|||||||
if (!nearbyGrids.Add(grid.GridEntityId)) continue;
|
if (!nearbyGrids.Add(grid.GridEntityId)) continue;
|
||||||
|
|
||||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
||||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
|
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can do proximity
|
// Can do proximity
|
||||||
@@ -501,7 +502,7 @@ public sealed partial class ShuttleSystem
|
|||||||
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
|
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
|
||||||
|
|
||||||
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
|
||||||
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
|
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameStates;
|
using Robust.Server.GameStates;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Robust.Shared.Collections;
|
|||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
@@ -243,10 +244,10 @@ public sealed class StationSystem : EntitySystem
|
|||||||
foreach (var gridUid in component.Grids)
|
foreach (var gridUid in component.Grids)
|
||||||
{
|
{
|
||||||
if (!TryComp<MapGridComponent>(gridUid, out var grid) ||
|
if (!TryComp<MapGridComponent>(gridUid, out var grid) ||
|
||||||
grid.Grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
|
grid.LocalAABB.Size.LengthSquared < largestBounds.Size.LengthSquared)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
largestBounds = grid.Grid.LocalAABB;
|
largestBounds = grid.LocalAABB;
|
||||||
largestGrid = gridUid;
|
largestGrid = gridUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.Station.Systems;
|
|||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -148,11 +149,9 @@ namespace Content.Server.StationEvents.Events
|
|||||||
if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
|
if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var grid = gridComp.Grid;
|
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
var (gridPos, _, gridMatrix) = Transform(targetGrid).GetWorldPositionRotationMatrix();
|
var (gridPos, _, gridMatrix) = Transform(targetGrid).GetWorldPositionRotationMatrix();
|
||||||
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
|
var gridBounds = gridMatrix.TransformBox(gridComp.LocalAABB);
|
||||||
|
|
||||||
for (var i = 0; i < 10; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@@ -160,15 +159,15 @@ namespace Content.Server.StationEvents.Events
|
|||||||
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
var randomY = RobustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top);
|
||||||
|
|
||||||
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y);
|
||||||
if (_atmosphere.IsTileSpace(grid.GridEntityId, Transform(targetGrid).MapUid, tile,
|
if (_atmosphere.IsTileSpace(gridComp.GridEntityId, Transform(targetGrid).MapUid, tile,
|
||||||
mapGridComp: gridComp)
|
mapGridComp: gridComp)
|
||||||
|| _atmosphere.IsTileAirBlocked(grid.GridEntityId, tile, mapGridComp: gridComp))
|
|| _atmosphere.IsTileAirBlocked(gridComp.GridEntityId, tile, mapGridComp: gridComp))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
targetCoords = grid.GridTileToLocal(tile);
|
targetCoords = gridComp.GridTileToLocal(tile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Server.Tabletop
|
namespace Content.Server.Tabletop
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Maps;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -94,7 +95,7 @@ namespace Content.Server.Tiles
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlaceAt(IMapGrid mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
|
private void PlaceAt(MapGridComponent mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
|
||||||
{
|
{
|
||||||
var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants);
|
var variant = _random.Pick(((ContentTileDefinition) _tileDefinitionManager[tileId]).PlacementVariants);
|
||||||
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));
|
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
|
|
||||||
namespace Content.Shared.Coordinates
|
namespace Content.Shared.Coordinates
|
||||||
{
|
{
|
||||||
@@ -19,17 +20,17 @@ namespace Content.Shared.Coordinates
|
|||||||
return new EntityCoordinates(id, x, y);
|
return new EntityCoordinates(id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this IMapGrid grid, Vector2 offset)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, Vector2 offset)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, offset);
|
return ToCoordinates(grid.GridEntityId, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this IMapGrid grid, float x, float y)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid, float x, float y)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, x, y);
|
return ToCoordinates(grid.GridEntityId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates ToCoordinates(this IMapGrid grid)
|
public static EntityCoordinates ToCoordinates(this MapGridComponent grid)
|
||||||
{
|
{
|
||||||
return ToCoordinates(grid.GridEntityId, Vector2.Zero);
|
return ToCoordinates(grid.GridEntityId, Vector2.Zero);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Ghost;
|
|||||||
using Content.Shared.Radiation;
|
using Content.Shared.Radiation;
|
||||||
using Content.Shared.Radiation.Components;
|
using Content.Shared.Radiation.Components;
|
||||||
using Content.Shared.Singularity.Components;
|
using Content.Shared.Singularity.Components;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Collision.Shapes;
|
using Robust.Shared.Physics.Collision.Shapes;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Interaction.Events;
|
|||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.SubFloor
|
namespace Content.Shared.SubFloor
|
||||||
@@ -107,14 +108,14 @@ namespace Content.Shared.SubFloor
|
|||||||
UpdateAppearance(uid, component);
|
UpdateAppearance(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasFloorCover(IMapGrid grid, Vector2i position)
|
public bool HasFloorCover(MapGridComponent grid, Vector2i position)
|
||||||
{
|
{
|
||||||
// TODO Redo this function. Currently wires on an asteroid are always "below the floor"
|
// TODO Redo this function. Currently wires on an asteroid are always "below the floor"
|
||||||
var tileDef = (ContentTileDefinition) _tileDefinitionManager[grid.GetTileRef(position).Tile.TypeId];
|
var tileDef = (ContentTileDefinition) _tileDefinitionManager[grid.GetTileRef(position).Tile.TypeId];
|
||||||
return !tileDef.IsSubFloor;
|
return !tileDef.IsSubFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTile(IMapGrid grid, Vector2i position)
|
private void UpdateTile(MapGridComponent grid, Vector2i position)
|
||||||
{
|
{
|
||||||
var covered = HasFloorCover(grid, position);
|
var covered = HasFloorCover(grid, position);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
density: 100
|
density: 100
|
||||||
hard: true
|
hard: true
|
||||||
id: projectile
|
id: projectile
|
||||||
# Didn't use MapGrid for now as the bounds are stuffed.
|
# Didn't use MapGridComponent for now as the bounds are stuffed.
|
||||||
layer:
|
layer:
|
||||||
- LargeMobLayer
|
- LargeMobLayer
|
||||||
mask:
|
mask:
|
||||||
|
|||||||
Reference in New Issue
Block a user