Replace obsolete xform.ToMap() with xformSystem.ToMapCoordinates() (#30010)
* Get rid of a bunch of obsolete usages * position --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -48,11 +48,11 @@ namespace Content.Client.Construction
|
|||||||
|
|
||||||
CommandBinds.Builder
|
CommandBinds.Builder
|
||||||
.Bind(ContentKeyFunctions.OpenCraftingMenu,
|
.Bind(ContentKeyFunctions.OpenCraftingMenu,
|
||||||
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction:true))
|
new PointerInputCmdHandler(HandleOpenCraftingMenu, outsidePrediction: true))
|
||||||
.Bind(EngineKeyFunctions.Use,
|
.Bind(EngineKeyFunctions.Use,
|
||||||
new PointerInputCmdHandler(HandleUse, outsidePrediction: true))
|
new PointerInputCmdHandler(HandleUse, outsidePrediction: true))
|
||||||
.Bind(ContentKeyFunctions.EditorFlipObject,
|
.Bind(ContentKeyFunctions.EditorFlipObject,
|
||||||
new PointerInputCmdHandler(HandleFlip, outsidePrediction:true))
|
new PointerInputCmdHandler(HandleFlip, outsidePrediction: true))
|
||||||
.Register<ConstructionSystem>();
|
.Register<ConstructionSystem>();
|
||||||
|
|
||||||
SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
|
SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
|
||||||
@@ -196,7 +196,7 @@ namespace Content.Client.Construction
|
|||||||
if (GhostPresent(loc))
|
if (GhostPresent(loc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var predicate = GetPredicate(prototype.CanBuildInImpassable, loc.ToMap(EntityManager, _transformSystem));
|
var predicate = GetPredicate(prototype.CanBuildInImpassable, _transformSystem.ToMapCoordinates(loc));
|
||||||
if (!_examineSystem.InRangeUnOccluded(user, loc, 20f, predicate: predicate))
|
if (!_examineSystem.InRangeUnOccluded(user, loc, 20f, predicate: predicate))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
|
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var coords = args.Coordinates.ToMap(_entityManager, _xform);
|
var coords = _xform.ToMapCoordinates(args.Coordinates);
|
||||||
|
|
||||||
if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
|
if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
|
||||||
OpenRootMenu(entities);
|
OpenRootMenu(entities);
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ namespace Content.Client.Gameplay
|
|||||||
|
|
||||||
public IEnumerable<EntityUid> GetClickableEntities(EntityCoordinates coordinates)
|
public IEnumerable<EntityUid> GetClickableEntities(EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
return GetClickableEntities(coordinates.ToMap(_entityManager, _entitySystemManager.GetEntitySystem<SharedTransformSystem>()));
|
var transformSystem = _entitySystemManager.GetEntitySystem<SharedTransformSystem>();
|
||||||
|
return GetClickableEntities(transformSystem.ToMapCoordinates(coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<EntityUid> GetClickableEntities(MapCoordinates coordinates)
|
public IEnumerable<EntityUid> GetClickableEntities(MapCoordinates coordinates)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly ClothingSystem _clothing = default!;
|
[Dependency] private readonly ClothingSystem _clothing = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -73,11 +74,11 @@ public sealed class JetpackSystem : SharedJetpackSystem
|
|||||||
|
|
||||||
var uidXform = Transform(uid);
|
var uidXform = Transform(uid);
|
||||||
var coordinates = uidXform.Coordinates;
|
var coordinates = uidXform.Coordinates;
|
||||||
var gridUid = coordinates.GetGridUid(EntityManager);
|
var gridUid = _transform.GetGrid(coordinates);
|
||||||
|
|
||||||
if (TryComp<MapGridComponent>(gridUid, out var grid))
|
if (TryComp<MapGridComponent>(gridUid, out var grid))
|
||||||
{
|
{
|
||||||
coordinates = new EntityCoordinates(gridUid.Value, grid.WorldToLocal(coordinates.ToMapPos(EntityManager, _transform)));
|
coordinates = new EntityCoordinates(gridUid.Value, _mapSystem.WorldToLocal(gridUid.Value, grid, _transform.ToMapCoordinates(coordinates).Position));
|
||||||
}
|
}
|
||||||
else if (uidXform.MapUid != null)
|
else if (uidXform.MapUid != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace Content.Client.NPC
|
|||||||
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
|
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
|
var localAABB = invWorldMatrix.TransformBox(aabb.Enlarged(float.Epsilon - SharedPathfindingSystem.ChunkSize));
|
||||||
|
|
||||||
foreach (var chunk in crumbs)
|
foreach (var chunk in crumbs)
|
||||||
@@ -287,7 +287,7 @@ namespace Content.Client.NPC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var invGridMatrix = gridXform.InvWorldMatrix;
|
var invGridMatrix = _transformSystem.GetInvWorldMatrix(gridXform);
|
||||||
DebugPathPoly? nearest = null;
|
DebugPathPoly? nearest = null;
|
||||||
|
|
||||||
foreach (var poly in tile)
|
foreach (var poly in tile)
|
||||||
@@ -359,7 +359,7 @@ namespace Content.Client.NPC
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(aabb);
|
var localAABB = invWorldMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invMatrix.TransformBox(aabb);
|
var localAABB = invMatrix.TransformBox(aabb);
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ namespace Content.Client.NPC
|
|||||||
if (neighborPoly.NetEntity != poly.GraphUid)
|
if (neighborPoly.NetEntity != poly.GraphUid)
|
||||||
{
|
{
|
||||||
color = Color.Green;
|
color = Color.Green;
|
||||||
var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager, _transformSystem);
|
var neighborMap = _transformSystem.ToMapCoordinates(_entManager.GetCoordinates(neighborPoly));
|
||||||
|
|
||||||
if (neighborMap.MapId != args.MapId)
|
if (neighborMap.MapId != args.MapId)
|
||||||
continue;
|
continue;
|
||||||
@@ -517,7 +517,7 @@ namespace Content.Client.NPC
|
|||||||
!xformQuery.TryGetComponent(grid, out var gridXform))
|
!xformQuery.TryGetComponent(grid, out var gridXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
|
var (_, _, worldMatrix, invWorldMatrix) = _transformSystem.GetWorldPositionRotationMatrixWithInv(gridXform);
|
||||||
worldHandle.SetTransform(worldMatrix);
|
worldHandle.SetTransform(worldMatrix);
|
||||||
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
|
var localAABB = invWorldMatrix.TransformBox(args.WorldBounds);
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ namespace Content.Client.NPC
|
|||||||
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
|
if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
worldHandle.SetTransform(_transformSystem.GetWorldMatrix(graphXform));
|
||||||
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
|
worldHandle.DrawRect(node.Box, Color.Orange.WithAlpha(0.10f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,7 +568,7 @@ namespace Content.Client.NPC
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
matrix = graph;
|
matrix = graph;
|
||||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
worldHandle.SetTransform(_transformSystem.GetWorldMatrix(graphXform));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));
|
worldHandle.DrawRect(node.Box, new Color(0f, cost / highestGScore, 1f - (cost / highestGScore), 0.10f));
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ public sealed class JointVisualsOverlay : Overlay
|
|||||||
coordsA = coordsA.Offset(rotA.RotateVec(visuals.OffsetA));
|
coordsA = coordsA.Offset(rotA.RotateVec(visuals.OffsetA));
|
||||||
coordsB = coordsB.Offset(rotB.RotateVec(visuals.OffsetB));
|
coordsB = coordsB.Offset(rotB.RotateVec(visuals.OffsetB));
|
||||||
|
|
||||||
var posA = coordsA.ToMapPos(_entManager, xformSystem);
|
var posA = xformSystem.ToMapCoordinates(coordsA).Position;
|
||||||
var posB = coordsB.ToMapPos(_entManager, xformSystem);
|
var posB = xformSystem.ToMapCoordinates(coordsB).Position;
|
||||||
var diff = (posB - posA);
|
var diff = (posB - posA);
|
||||||
var length = diff.Length();
|
var length = diff.Length();
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
if (!blip.Selectable)
|
if (!blip.Selectable)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var currentDistance = (blip.Coordinates.ToMapPos(EntManager, _transformSystem) - worldPosition).Length();
|
var currentDistance = (_transformSystem.ToMapCoordinates(blip.Coordinates).Position - worldPosition).Length();
|
||||||
|
|
||||||
if (closestDistance < currentDistance || currentDistance * MinimapScale > MaxSelectableDistance)
|
if (closestDistance < currentDistance || currentDistance * MinimapScale > MaxSelectableDistance)
|
||||||
continue;
|
continue;
|
||||||
@@ -397,7 +397,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
{
|
{
|
||||||
if (lit && value.Visible)
|
if (lit && value.Visible)
|
||||||
{
|
{
|
||||||
var mapPos = coord.ToMap(EntManager, _transformSystem);
|
var mapPos = _transformSystem.ToMapCoordinates(coord);
|
||||||
|
|
||||||
if (mapPos.MapId != MapId.Nullspace)
|
if (mapPos.MapId != MapId.Nullspace)
|
||||||
{
|
{
|
||||||
@@ -418,7 +418,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
if (blip.Texture == null)
|
if (blip.Texture == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var mapPos = blip.Coordinates.ToMap(EntManager, _transformSystem);
|
var mapPos = _transformSystem.ToMapCoordinates(blip.Coordinates);
|
||||||
|
|
||||||
if (mapPos.MapId != MapId.Nullspace)
|
if (mapPos.MapId != MapId.Nullspace)
|
||||||
{
|
{
|
||||||
@@ -535,7 +535,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
// East edge
|
// East edge
|
||||||
neighborData = 0;
|
neighborData = 0;
|
||||||
if (relativeTile.X != SharedNavMapSystem.ChunkSize - 1)
|
if (relativeTile.X != SharedNavMapSystem.ChunkSize - 1)
|
||||||
neighborData = chunk.TileData[i+SharedNavMapSystem.ChunkSize];
|
neighborData = chunk.TileData[i + SharedNavMapSystem.ChunkSize];
|
||||||
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Right, out neighborChunk))
|
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Right, out neighborChunk))
|
||||||
neighborData = neighborChunk.TileData[i + SharedNavMapSystem.ChunkSize - SharedNavMapSystem.ArraySize];
|
neighborData = neighborChunk.TileData[i + SharedNavMapSystem.ChunkSize - SharedNavMapSystem.ArraySize];
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
// South edge
|
// South edge
|
||||||
neighborData = 0;
|
neighborData = 0;
|
||||||
if (relativeTile.Y != 0)
|
if (relativeTile.Y != 0)
|
||||||
neighborData = chunk.TileData[i-1];
|
neighborData = chunk.TileData[i - 1];
|
||||||
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Down, out neighborChunk))
|
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Down, out neighborChunk))
|
||||||
neighborData = neighborChunk.TileData[i - 1 + SharedNavMapSystem.ChunkSize];
|
neighborData = neighborChunk.TileData[i - 1 + SharedNavMapSystem.ChunkSize];
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ public partial class NavMapControl : MapGridControl
|
|||||||
// West edge
|
// West edge
|
||||||
neighborData = 0;
|
neighborData = 0;
|
||||||
if (relativeTile.X != 0)
|
if (relativeTile.X != 0)
|
||||||
neighborData = chunk.TileData[i-SharedNavMapSystem.ChunkSize];
|
neighborData = chunk.TileData[i - SharedNavMapSystem.ChunkSize];
|
||||||
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Left, out neighborChunk))
|
else if (_navMap.Chunks.TryGetValue(chunkOrigin + Vector2i.Left, out neighborChunk))
|
||||||
neighborData = neighborChunk.TileData[i - SharedNavMapSystem.ChunkSize + SharedNavMapSystem.ArraySize];
|
neighborData = neighborChunk.TileData[i - SharedNavMapSystem.ChunkSize + SharedNavMapSystem.ArraySize];
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public sealed class AlignRCDConstruction : PlacementMode
|
|||||||
_unalignedMouseCoords = ScreenToCursorGrid(mouseScreen);
|
_unalignedMouseCoords = ScreenToCursorGrid(mouseScreen);
|
||||||
MouseCoords = _unalignedMouseCoords.AlignWithClosestGridTile(SearchBoxSize, _entityManager, _mapManager);
|
MouseCoords = _unalignedMouseCoords.AlignWithClosestGridTile(SearchBoxSize, _entityManager, _mapManager);
|
||||||
|
|
||||||
var gridId = MouseCoords.GetGridUid(_entityManager);
|
var gridId = _transformSystem.GetGrid(MouseCoords);
|
||||||
|
|
||||||
if (!_entityManager.TryGetComponent<MapGridComponent>(gridId, out var mapGrid))
|
if (!_entityManager.TryGetComponent<MapGridComponent>(gridId, out var mapGrid))
|
||||||
return;
|
return;
|
||||||
@@ -106,7 +106,7 @@ public sealed class AlignRCDConstruction : PlacementMode
|
|||||||
if (currentState is not GameplayStateBase screen)
|
if (currentState is not GameplayStateBase screen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var target = screen.GetClickedEntity(_unalignedMouseCoords.ToMap(_entityManager, _transformSystem));
|
var target = screen.GetClickedEntity(_transformSystem.ToMapCoordinates(_unalignedMouseCoords));
|
||||||
|
|
||||||
// Determine if the RCD operation is valid or not
|
// Determine if the RCD operation is valid or not
|
||||||
if (!_rcdSystem.IsRCDOperationStillValid(heldEntity.Value, rcd, mapGridData.Value, target, player.Value, false))
|
if (!_rcdSystem.IsRCDOperationStillValid(heldEntity.Value, rcd, mapGridData.Value, target, player.Value, false))
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace Content.Client.Sandbox
|
|||||||
[Dependency] private readonly IPlacementManager _placement = default!;
|
[Dependency] private readonly IPlacementManager _placement = default!;
|
||||||
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
|
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
|
|
||||||
private bool _sandboxEnabled;
|
private bool _sandboxEnabled;
|
||||||
public bool SandboxAllowed { get; private set; }
|
public bool SandboxAllowed { get; private set; }
|
||||||
@@ -92,7 +93,7 @@ namespace Content.Client.Sandbox
|
|||||||
&& EntityManager.TryGetComponent(uid, out MetaDataComponent? comp)
|
&& EntityManager.TryGetComponent(uid, out MetaDataComponent? comp)
|
||||||
&& !comp.EntityDeleted)
|
&& !comp.EntityDeleted)
|
||||||
{
|
{
|
||||||
if (comp.EntityPrototype == null || comp.EntityPrototype.NoSpawn || comp.EntityPrototype.Abstract)
|
if (comp.EntityPrototype == null || comp.EntityPrototype.HideSpawnMenu || comp.EntityPrototype.Abstract)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_placement.Eraser)
|
if (_placement.Eraser)
|
||||||
@@ -109,7 +110,8 @@ namespace Content.Client.Sandbox
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try copy tile.
|
// Try copy tile.
|
||||||
if (!_map.TryFindGridAt(coords.ToMap(EntityManager, _transform), out _, out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
|
|
||||||
|
if (!_map.TryFindGridAt(_transform.ToMapCoordinates(coords), out var gridUid, out var grid) || !_mapSystem.TryGetTileRef(gridUid, grid, coords, out var tileRef))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_placement.Eraser)
|
if (_placement.Eraser)
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ public sealed partial class ShuttleSystem
|
|||||||
switch (mapObj)
|
switch (mapObj)
|
||||||
{
|
{
|
||||||
case ShuttleBeaconObject beacon:
|
case ShuttleBeaconObject beacon:
|
||||||
return GetCoordinates(beacon.Coordinates).ToMap(EntityManager, XformSystem);
|
return XformSystem.ToMapCoordinates(GetCoordinates(beacon.Coordinates));
|
||||||
case ShuttleExclusionObject exclusion:
|
case ShuttleExclusionObject exclusion:
|
||||||
return GetCoordinates(exclusion.Coordinates).ToMap(EntityManager, XformSystem);
|
return XformSystem.ToMapCoordinates(GetCoordinates(exclusion.Coordinates));
|
||||||
case GridMapObject grid:
|
case GridMapObject grid:
|
||||||
var gridXform = Transform(grid.Entity);
|
var gridXform = Transform(grid.Entity);
|
||||||
|
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
if (mapO is not ShuttleBeaconObject beacon)
|
if (mapO is not ShuttleBeaconObject beacon)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var beaconCoords = EntManager.GetCoordinates(beacon.Coordinates).ToMap(EntManager, _xformSystem);
|
var beaconCoords = _xformSystem.ToMapCoordinates(EntManager.GetCoordinates(beacon.Coordinates));
|
||||||
var position = Vector2.Transform(beaconCoords.Position, mapTransform);
|
var position = Vector2.Transform(beaconCoords.Position, mapTransform);
|
||||||
var localPos = ScalePosition(position with {Y = -position.Y});
|
var localPos = ScalePosition(position with {Y = -position.Y});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Client.Animations;
|
using Content.Client.Animations;
|
||||||
using Content.Shared.Hands;
|
using Content.Shared.Hands;
|
||||||
@@ -149,7 +149,7 @@ public sealed class StorageSystem : SharedStorageSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var finalMapPos = finalCoords.ToMapPos(EntityManager, TransformSystem);
|
var finalMapPos = TransformSystem.ToMapCoordinates(finalCoords).Position;
|
||||||
var finalPos = Vector2.Transform(finalMapPos, TransformSystem.GetInvWorldMatrix(initialCoords.EntityId));
|
var finalPos = Vector2.Transform(finalMapPos, TransformSystem.GetInvWorldMatrix(initialCoords.EntityId));
|
||||||
|
|
||||||
_entityPickupAnimation.AnimateEntityPickup(item, initialCoords, finalPos, initialAngle);
|
_entityPickupAnimation.AnimateEntityPickup(item, initialCoords, finalPos, initialAngle);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetMap = coordinates.ToMap(EntityManager, TransformSystem);
|
var targetMap = TransformSystem.ToMapCoordinates(coordinates);
|
||||||
|
|
||||||
if (targetMap.MapId != userXform.MapID)
|
if (targetMap.MapId != userXform.MapID)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define target coordinates relative to gun entity, so that network latency on moving grids doesn't fuck up the target location.
|
// Define target coordinates relative to gun entity, so that network latency on moving grids doesn't fuck up the target location.
|
||||||
var coordinates = EntityCoordinates.FromMap(entity, mousePos, TransformSystem, EntityManager);
|
var coordinates = TransformSystem.ToCoordinates(entity, mousePos);
|
||||||
|
|
||||||
NetEntity? target = null;
|
NetEntity? target = null;
|
||||||
if (_state.CurrentState is GameplayStateBase screen)
|
if (_state.CurrentState is GameplayStateBase screen)
|
||||||
@@ -200,7 +200,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
// Rather than splitting client / server for every ammo provider it's easier
|
// Rather than splitting client / server for every ammo provider it's easier
|
||||||
// to just delete the spawned entities. This is for programmer sanity despite the wasted perf.
|
// to just delete the spawned entities. This is for programmer sanity despite the wasted perf.
|
||||||
// This also means any ammo specific stuff can be grabbed as necessary.
|
// This also means any ammo specific stuff can be grabbed as necessary.
|
||||||
var direction = fromCoordinates.ToMapPos(EntityManager, TransformSystem) - toCoordinates.ToMapPos(EntityManager, TransformSystem);
|
var direction = TransformSystem.ToMapCoordinates(fromCoordinates).Position - TransformSystem.ToMapCoordinates(toCoordinates).Position;
|
||||||
var worldAngle = direction.ToAngle().Opposite();
|
var worldAngle = direction.ToAngle().Opposite();
|
||||||
|
|
||||||
foreach (var (ent, shootable) in ammo)
|
foreach (var (ent, shootable) in ammo)
|
||||||
@@ -383,6 +383,6 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
var uidPlayer = EnsureComp<AnimationPlayerComponent>(gunUid);
|
var uidPlayer = EnsureComp<AnimationPlayerComponent>(gunUid);
|
||||||
|
|
||||||
_animPlayer.Stop(gunUid, uidPlayer, "muzzle-flash-light");
|
_animPlayer.Stop(gunUid, uidPlayer, "muzzle-flash-light");
|
||||||
_animPlayer.Play((gunUid, uidPlayer), animTwo,"muzzle-flash-light");
|
_animPlayer.Play((gunUid, uidPlayer), animTwo, "muzzle-flash-light");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,8 +145,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
_popup.PopupEntity(Loc.GetString("pointing-system-try-point-cannot-reach"), player, player);
|
_popup.PopupEntity(Loc.GetString("pointing-system-try-point-cannot-reach"), player, player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
var mapCoordsPointed = _transform.ToMapCoordinates(coordsPointed);
|
||||||
var mapCoordsPointed = coordsPointed.ToMap(EntityManager, _transform);
|
|
||||||
_rotateToFaceSystem.TryFaceCoordinates(player, mapCoordsPointed.Position);
|
_rotateToFaceSystem.TryFaceCoordinates(player, mapCoordsPointed.Position);
|
||||||
|
|
||||||
var arrow = EntityManager.SpawnEntity("PointingArrow", coordsPointed);
|
var arrow = EntityManager.SpawnEntity("PointingArrow", coordsPointed);
|
||||||
@@ -154,7 +153,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
if (TryComp<PointingArrowComponent>(arrow, out var pointing))
|
if (TryComp<PointingArrowComponent>(arrow, out var pointing))
|
||||||
{
|
{
|
||||||
if (TryComp(player, out TransformComponent? xformPlayer))
|
if (TryComp(player, out TransformComponent? xformPlayer))
|
||||||
pointing.StartPosition = EntityCoordinates.FromMap(arrow, xformPlayer.Coordinates.ToMap(EntityManager, _transform), _transform).Position;
|
pointing.StartPosition = _transform.ToCoordinates((player, xformPlayer), _transform.ToMapCoordinates(xformPlayer.Coordinates)).Position;
|
||||||
|
|
||||||
pointing.EndTime = _gameTiming.CurTime + PointDuration;
|
pointing.EndTime = _gameTiming.CurTime + PointDuration;
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ public abstract class SharedActionsSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entityCoordinatesTarget = GetCoordinates(netCoordinatesTarget);
|
var entityCoordinatesTarget = GetCoordinates(netCoordinatesTarget);
|
||||||
_rotateToFaceSystem.TryFaceCoordinates(user, entityCoordinatesTarget.ToMapPos(EntityManager, _transformSystem));
|
_rotateToFaceSystem.TryFaceCoordinates(user, _transformSystem.ToMapCoordinates(entityCoordinatesTarget).Position);
|
||||||
|
|
||||||
if (!ValidateWorldTarget(user, entityCoordinatesTarget, (actionEnt, worldAction)))
|
if (!ValidateWorldTarget(user, entityCoordinatesTarget, (actionEnt, worldAction)))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user