Inline Transform
This commit is contained in:
@@ -46,13 +46,13 @@ namespace Content.Client.AI
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_eyeManager.GetWorldViewport().Contains(entity.Transform.WorldPosition))
|
if (!_eyeManager.GetWorldViewport().Contains(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition))
|
||||||
{
|
{
|
||||||
panel.Visible = false;
|
panel.Visible = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (x, y) = _eyeManager.CoordinatesToScreen(entity.Transform.Coordinates).Position;
|
var (x, y) = _eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates).Position;
|
||||||
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
|
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
|
||||||
panel.Visible = true;
|
panel.Visible = true;
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace Content.Client.AI
|
|||||||
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||||
{
|
{
|
||||||
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (attachedEntity == null || !CachedRegions.TryGetValue(attachedEntity.Transform.GridID, out var entityRegions))
|
if (attachedEntity == null || !CachedRegions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Uid).GridID, out var entityRegions))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ namespace Content.Client.AI
|
|||||||
screenTile.X + 15.0f,
|
screenTile.X + 15.0f,
|
||||||
screenTile.Y + 15.0f);
|
screenTile.Y + 15.0f);
|
||||||
|
|
||||||
screenHandle.DrawRect(box, _cachedRegionColors[attachedEntity.Transform.GridID][region]);
|
screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Uid).GridID][region]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ namespace Content.Client.AI
|
|||||||
private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||||
{
|
{
|
||||||
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (attachedEntity == null || !Regions.TryGetValue(attachedEntity.Transform.GridID, out var entityRegions))
|
if (attachedEntity == null || !Regions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Uid).GridID, out var entityRegions))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -356,7 +356,7 @@ namespace Content.Client.AI
|
|||||||
screenTile.X + 15.0f,
|
screenTile.X + 15.0f,
|
||||||
screenTile.Y + 15.0f);
|
screenTile.Y + 15.0f);
|
||||||
|
|
||||||
screenHandle.DrawRect(box, _regionColors[attachedEntity.Transform.GridID][chunk][region]);
|
screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Uid).GridID][chunk][region]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Administration
|
namespace Content.Client.Administration
|
||||||
@@ -41,7 +42,7 @@ namespace Content.Client.Administration
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if not on the same map, continue
|
// if not on the same map, continue
|
||||||
if (entity.Transform.MapID != _eyeManager.CurrentMap)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID != _eyeManager.CurrentMap)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Robust.Client.Console;
|
|||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _data)
|
foreach (var grid in _data)
|
||||||
{
|
{
|
||||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
|
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid) : null).GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _gridData)
|
foreach (var grid in _gridData)
|
||||||
{
|
{
|
||||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
|
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid) : null).GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _gridData)
|
foreach (var grid in _gridData)
|
||||||
{
|
{
|
||||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
|
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid) : null).GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Robust.Client.Console;
|
|||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _data)
|
foreach (var grid in _data)
|
||||||
{
|
{
|
||||||
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
|
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
|
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid) : null).GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ namespace Content.Client.Audio
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coordinates = player.Transform.Coordinates;
|
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).Coordinates;
|
||||||
|
|
||||||
foreach (var (comp, (stream, _)) in _playingSounds.ToArray())
|
foreach (var (comp, (stream, _)) in _playingSounds.ToArray())
|
||||||
{
|
{
|
||||||
if (!comp.Deleted && comp.Enabled && comp.Owner.Transform.Coordinates.TryDistance(EntityManager, coordinates, out var range) &&
|
if (!comp.Deleted && comp.Enabled && IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) &&
|
||||||
range <= comp.Range)
|
range <= comp.Range)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -140,7 +140,7 @@ namespace Content.Client.Audio
|
|||||||
_playingSounds.ContainsKey(ambientComp) ||
|
_playingSounds.ContainsKey(ambientComp) ||
|
||||||
!ambientComp.Enabled ||
|
!ambientComp.Enabled ||
|
||||||
// We'll also do this crude distance check because it's what we're doing in the active loop above.
|
// We'll also do this crude distance check because it's what we're doing in the active loop above.
|
||||||
!entity.Transform.Coordinates.TryDistance(EntityManager, coordinates, out var range) ||
|
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) ||
|
||||||
range > ambientComp.Range - RangeBuffer)
|
range > ambientComp.Range - RangeBuffer)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Client.Body.UI
|
|||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(scannerState.Uid, out _entity))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(scannerState.Uid, out _entity))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}");
|
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Owner.Uid).MapPosition}");
|
||||||
}
|
}
|
||||||
|
|
||||||
_display?.UpdateDisplay(_entity);
|
_display?.UpdateDisplay(_entity);
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType)
|
private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType)
|
||||||
{
|
{
|
||||||
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
|
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
|
||||||
if (entity.Transform.MapID != _eyeManager.CurrentMap)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID != _eyeManager.CurrentMap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_queuedSpeechBubbles.TryGetValue(entity.Uid, out var queueData))
|
if (!_queuedSpeechBubbles.TryGetValue(entity.Uid, out var queueData))
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace Content.Client.Chat.UI
|
|||||||
_verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds);
|
_verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_senderEntity.Transform.Coordinates.IsValid(IoCManager.Resolve<IEntityManager>()))
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_senderEntity.Uid).Coordinates.IsValid(IoCManager.Resolve<IEntityManager>()))
|
||||||
{
|
{
|
||||||
Modulate = Color.White.WithAlpha(0);
|
Modulate = Color.White.WithAlpha(0);
|
||||||
return;
|
return;
|
||||||
@@ -123,7 +123,7 @@ namespace Content.Client.Chat.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var worldPos = _senderEntity.Transform.WorldPosition;
|
var worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_senderEntity.Uid).WorldPosition;
|
||||||
var scale = _eyeManager.MainViewport.GetRenderScale();
|
var scale = _eyeManager.MainViewport.GetRenderScale();
|
||||||
var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale);
|
var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale);
|
||||||
var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale;
|
var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Content.Client.Clickable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = Owner.Transform;
|
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid);
|
||||||
var localPos = transform.InvWorldMatrix.Transform(worldPos);
|
var localPos = transform.InvWorldMatrix.Transform(worldPos);
|
||||||
var spriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix());
|
var spriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix());
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace Content.Client.Construction
|
|||||||
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost.Uid);
|
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost.Uid);
|
||||||
comp.Prototype = prototype;
|
comp.Prototype = prototype;
|
||||||
comp.GhostId = _nextId++;
|
comp.GhostId = _nextId++;
|
||||||
ghost.Transform.LocalRotation = dir.ToAngle();
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Uid).LocalRotation = dir.ToAngle();
|
||||||
_ghosts.Add(comp.GhostId, comp);
|
_ghosts.Add(comp.GhostId, comp);
|
||||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost.Uid);
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost.Uid);
|
||||||
sprite.Color = new Color(48, 255, 48, 128);
|
sprite.Color = new Color(48, 255, 48, 128);
|
||||||
@@ -191,7 +191,7 @@ namespace Content.Client.Construction
|
|||||||
{
|
{
|
||||||
foreach (var ghost in _ghosts)
|
foreach (var ghost in _ghosts)
|
||||||
{
|
{
|
||||||
if (ghost.Value.Owner.Transform.Coordinates.Equals(loc)) return true;
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Value.Owner.Uid).Coordinates.Equals(loc)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -206,7 +206,7 @@ namespace Content.Client.Construction
|
|||||||
throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}");
|
throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = ghost.Owner.Transform;
|
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Owner.Uid);
|
||||||
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||||
RaiseNetworkEvent(msg);
|
RaiseNetworkEvent(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
|
var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
|
||||||
|
|
||||||
var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId,
|
var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId,
|
||||||
BoundKeyState.Down, entity.Transform.Coordinates, args.PointerLocation, entity.Uid);
|
BoundKeyState.Down, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates, args.PointerLocation, entity.Uid);
|
||||||
|
|
||||||
var session = _playerManager.LocalPlayer?.Session;
|
var session = _playerManager.LocalPlayer?.Session;
|
||||||
if (session != null)
|
if (session != null)
|
||||||
|
|||||||
@@ -59,23 +59,23 @@ namespace Content.Client.DoAfter
|
|||||||
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
|
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
|
||||||
{
|
{
|
||||||
var doAfters = comp.DoAfters.ToList();
|
var doAfters = comp.DoAfters.ToList();
|
||||||
var compPos = comp.Owner.Transform.WorldPosition;
|
var compPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).WorldPosition;
|
||||||
|
|
||||||
if (doAfters.Count == 0 ||
|
if (doAfters.Count == 0 ||
|
||||||
comp.Owner.Transform.MapID != _attachedEntity.Transform.MapID ||
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapID ||
|
||||||
!viewbox.Contains(compPos))
|
!viewbox.Contains(compPos))
|
||||||
{
|
{
|
||||||
comp.Disable();
|
comp.Disable();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = (compPos - _attachedEntity.Transform.WorldPosition).Length +
|
var range = (compPos - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).WorldPosition).Length +
|
||||||
0.01f;
|
0.01f;
|
||||||
|
|
||||||
if (comp.Owner != _attachedEntity &&
|
if (comp.Owner != _attachedEntity &&
|
||||||
!ExamineSystemShared.InRangeUnOccluded(
|
!ExamineSystemShared.InRangeUnOccluded(
|
||||||
_attachedEntity.Transform.MapPosition,
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapPosition,
|
||||||
comp.Owner.Transform.MapPosition, range,
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).MapPosition, range,
|
||||||
entity => entity == comp.Owner || entity == _attachedEntity))
|
entity => entity == comp.Owner || entity == _attachedEntity))
|
||||||
{
|
{
|
||||||
comp.Disable();
|
comp.Disable();
|
||||||
@@ -84,7 +84,7 @@ namespace Content.Client.DoAfter
|
|||||||
|
|
||||||
comp.Enable();
|
comp.Enable();
|
||||||
|
|
||||||
var userGrid = comp.Owner.Transform.Coordinates;
|
var userGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).Coordinates;
|
||||||
|
|
||||||
// Check cancellations / finishes
|
// Check cancellations / finishes
|
||||||
foreach (var (id, doAfter) in doAfters)
|
foreach (var (id, doAfter) in doAfters)
|
||||||
@@ -117,7 +117,7 @@ namespace Content.Client.DoAfter
|
|||||||
if (doAfter.BreakOnTargetMove)
|
if (doAfter.BreakOnTargetMove)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) &&
|
if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) &&
|
||||||
!targetEntity.Transform.Coordinates.InRange(EntityManager, doAfter.TargetGrid,
|
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(targetEntity.Uid).Coordinates.InRange(EntityManager, doAfter.TargetGrid,
|
||||||
doAfter.MovementThreshold))
|
doAfter.MovementThreshold))
|
||||||
{
|
{
|
||||||
comp.Cancel(id, currentTime);
|
comp.Cancel(id, currentTime);
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ namespace Content.Client.DoAfter.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_eyeManager.CurrentMap != AttachedEntity.Transform.MapID ||
|
if (_eyeManager.CurrentMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).MapID ||
|
||||||
!AttachedEntity.Transform.Coordinates.IsValid(_entityManager))
|
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).Coordinates.IsValid(_entityManager))
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
return;
|
return;
|
||||||
@@ -217,7 +217,7 @@ namespace Content.Client.DoAfter.UI
|
|||||||
RemoveDoAfter(id);
|
RemoveDoAfter(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
var screenCoordinates = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates);
|
var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).Coordinates);
|
||||||
_playerPosition = new ScreenCoordinates(screenCoordinates.Position / UIScale, screenCoordinates.Window);
|
_playerPosition = new ScreenCoordinates(screenCoordinates.Position / UIScale, screenCoordinates.Window);
|
||||||
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
|
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ namespace Content.Client.DragDrop
|
|||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
_dragShadow.Transform.WorldRotation = _dragDropHelper.Dragged.Transform.WorldRotation;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragShadow.Uid).WorldRotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragDropHelper.Dragged.Uid).WorldRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightTargets();
|
HighlightTargets();
|
||||||
@@ -233,7 +233,7 @@ namespace Content.Client.DragDrop
|
|||||||
if (_dragShadow == null)
|
if (_dragShadow == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_dragShadow.Transform.WorldPosition = mousePos.Position;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragShadow.Uid).WorldPosition = mousePos.Position;
|
||||||
|
|
||||||
_targetRecheckTime += frameTime;
|
_targetRecheckTime += frameTime;
|
||||||
if (_targetRecheckTime > TargetRecheckInterval)
|
if (_targetRecheckTime > TargetRecheckInterval)
|
||||||
@@ -295,7 +295,7 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
// now when ending the drag, we will not replay the click because
|
// now when ending the drag, we will not replay the click because
|
||||||
// by this time we've determined the input was actually a drag attempt
|
// by this time we've determined the input was actually a drag attempt
|
||||||
var range = (args.Coordinates.ToMapPos(EntityManager) - _dragger.Transform.MapPosition.Position).Length + 0.01f;
|
var range = (args.Coordinates.ToMapPos(EntityManager) - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragger.Uid).MapPosition.Position).Length + 0.01f;
|
||||||
// tell the server we are dropping if we are over a valid drop target in range.
|
// tell the server we are dropping if we are over a valid drop target in range.
|
||||||
// We don't use args.EntityUid here because drag interactions generally should
|
// We don't use args.EntityUid here because drag interactions generally should
|
||||||
// work even if there's something "on top" of the drop target
|
// work even if there's something "on top" of the drop target
|
||||||
@@ -379,7 +379,7 @@ namespace Content.Client.DragDrop
|
|||||||
pvsEntity == _dragDropHelper.Dragged) continue;
|
pvsEntity == _dragDropHelper.Dragged) continue;
|
||||||
|
|
||||||
// check if it's able to be dropped on by current dragged entity
|
// check if it's able to be dropped on by current dragged entity
|
||||||
var dropArgs = new DragDropEvent(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
var dropArgs = new DragDropEvent(_dragger!, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pvsEntity.Uid).Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
||||||
|
|
||||||
var valid = ValidDragDrop(dropArgs);
|
var valid = ValidDragDrop(dropArgs);
|
||||||
if (valid == null) continue;
|
if (valid == null) continue;
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ namespace Content.Client.HealthOverlay
|
|||||||
{
|
{
|
||||||
var entity = mobState.Owner;
|
var entity = mobState.Owner;
|
||||||
|
|
||||||
if (_attachedEntity.Transform.MapID != entity.Transform.MapID ||
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID ||
|
||||||
!viewBox.Contains(entity.Transform.WorldPosition))
|
!viewBox.Contains(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition))
|
||||||
{
|
{
|
||||||
if (_guis.TryGetValue(entity.Uid, out var oldGui))
|
if (_guis.TryGetValue(entity.Uid, out var oldGui))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
MoreFrameUpdate(args);
|
MoreFrameUpdate(args);
|
||||||
|
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
_eyeManager.CurrentMap != Entity.Transform.MapID)
|
_eyeManager.CurrentMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Entity.Uid).MapID)
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
return;
|
return;
|
||||||
@@ -147,7 +147,7 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
var screenCoordinates = _eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates);
|
var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Entity.Uid).Coordinates);
|
||||||
var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates);
|
var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates);
|
||||||
LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f));
|
LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
if (Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
// ensures lastposition initial value is populated on spawn. Just calling
|
// ensures lastposition initial value is populated on spawn. Just calling
|
||||||
// the hook here would cause a dirty event to fire needlessly
|
// the hook here would cause a dirty event to fire needlessly
|
||||||
@@ -95,9 +95,9 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
private void UpdateLastPosition()
|
private void UpdateLastPosition()
|
||||||
{
|
{
|
||||||
if (_mapManager.TryGetGrid(Owner.Transform.GridID, out var grid))
|
if (_mapManager.TryGetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID, out var grid))
|
||||||
{
|
{
|
||||||
_lastPosition = (Owner.Transform.GridID, grid.TileIndicesFor(Owner.Transform.Coordinates));
|
_lastPosition = (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -109,9 +109,9 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
internal virtual void CalculateNewSprite()
|
internal virtual void CalculateNewSprite()
|
||||||
{
|
{
|
||||||
if (!_mapManager.TryGetGrid(Owner.Transform.GridID, out var grid))
|
if (!_mapManager.TryGetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID, out var grid))
|
||||||
{
|
{
|
||||||
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {Owner.Transform.GridID} was missing.");
|
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID} was missing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CalculateNewSprite(grid);
|
CalculateNewSprite(grid);
|
||||||
@@ -136,14 +136,14 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
private void CalculateNewSpriteCardinal(IMapGrid grid)
|
private void CalculateNewSpriteCardinal(IMapGrid grid)
|
||||||
{
|
{
|
||||||
if (!Owner.Transform.Anchored || Sprite == null)
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored || Sprite == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dirs = CardinalConnectDirs.None;
|
var dirs = CardinalConnectDirs.None;
|
||||||
|
|
||||||
var position = Owner.Transform.Coordinates;
|
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||||
if (MatchingEntity(grid.GetInDir(position, Direction.North)))
|
if (MatchingEntity(grid.GetInDir(position, Direction.North)))
|
||||||
dirs |= CardinalConnectDirs.North;
|
dirs |= CardinalConnectDirs.North;
|
||||||
if (MatchingEntity(grid.GetInDir(position, Direction.South)))
|
if (MatchingEntity(grid.GetInDir(position, Direction.South)))
|
||||||
@@ -173,12 +173,12 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid)
|
protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid)
|
||||||
{
|
{
|
||||||
if (!Owner.Transform.Anchored)
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None);
|
return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
var position = Owner.Transform.Coordinates;
|
var position = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||||
var n = MatchingEntity(grid.GetInDir(position, Direction.North));
|
var n = MatchingEntity(grid.GetInDir(position, Direction.North));
|
||||||
var ne = MatchingEntity(grid.GetInDir(position, Direction.NorthEast));
|
var ne = MatchingEntity(grid.GetInDir(position, Direction.NorthEast));
|
||||||
var e = MatchingEntity(grid.GetInDir(position, Direction.East));
|
var e = MatchingEntity(grid.GetInDir(position, Direction.East));
|
||||||
@@ -240,7 +240,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Local is fine as we already know it's parented to the grid (due to the way anchoring works).
|
// Local is fine as we already know it's parented to the grid (due to the way anchoring works).
|
||||||
switch (Owner.Transform.LocalRotation.GetCardinalDir())
|
switch (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).LocalRotation.GetCardinalDir())
|
||||||
{
|
{
|
||||||
case Direction.North:
|
case Direction.North:
|
||||||
return (cornerSW, cornerSE, cornerNE, cornerNW);
|
return (cornerSW, cornerSE, cornerNE, cornerNW);
|
||||||
@@ -258,7 +258,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
|
|
||||||
if (Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
public void AnchorStateChanged()
|
public void AnchorStateChanged()
|
||||||
{
|
{
|
||||||
if (Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
||||||
UpdateLastPosition();
|
UpdateLastPosition();
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ namespace Content.Client.IconSmoothing
|
|||||||
// This is simpler to implement. If you want to optimize it be my guest.
|
// This is simpler to implement. If you want to optimize it be my guest.
|
||||||
var senderEnt = ev.Sender;
|
var senderEnt = ev.Sender;
|
||||||
if (IoCManager.Resolve<IEntityManager>().EntityExists(senderEnt.Uid) &&
|
if (IoCManager.Resolve<IEntityManager>().EntityExists(senderEnt.Uid) &&
|
||||||
_mapManager.TryGetGrid(senderEnt.Transform.GridID, out var grid1) &&
|
_mapManager.TryGetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(senderEnt.Uid).GridID, out var grid1) &&
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(senderEnt.Uid, out IconSmoothComponent? iconSmooth)
|
IoCManager.Resolve<IEntityManager>().TryGetComponent(senderEnt.Uid, out IconSmoothComponent? iconSmooth)
|
||||||
&& iconSmooth.Running)
|
&& iconSmooth.Running)
|
||||||
{
|
{
|
||||||
var coords = senderEnt.Transform.Coordinates;
|
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(senderEnt.Uid).Coordinates;
|
||||||
|
|
||||||
_dirtyEntities.Enqueue(senderEnt.Uid);
|
_dirtyEntities.Enqueue(senderEnt.Uid);
|
||||||
AddValidEntities(grid1.GetInDir(coords, Direction.North));
|
AddValidEntities(grid1.GetInDir(coords, Direction.North));
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Client.Interactable
|
|||||||
bool ignoreInsideBlocker = false,
|
bool ignoreInsideBlocker = false,
|
||||||
bool popup = false)
|
bool popup = false)
|
||||||
{
|
{
|
||||||
var otherPosition = other.Transform.MapPosition;
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
|
||||||
|
|
||||||
return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker,
|
return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker,
|
||||||
popup);
|
popup);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Client.ResourceManagement;
|
|||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -80,9 +81,9 @@ namespace Content.Client.NodeContainer
|
|||||||
|
|
||||||
var entity = _entityManager.GetEntity(node.Entity);
|
var entity = _entityManager.GetEntity(node.Entity);
|
||||||
|
|
||||||
var gridId = entity.Transform.GridID;
|
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID;
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var gridTile = grid.TileIndicesFor(entity.Transform.Coordinates);
|
var gridTile = grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append($"entity: {entity}\n");
|
sb.Append($"entity: {entity}\n");
|
||||||
@@ -119,10 +120,10 @@ namespace Content.Client.NodeContainer
|
|||||||
if (!_system.Entities.TryGetValue(entity.Uid, out var nodeData))
|
if (!_system.Entities.TryGetValue(entity.Uid, out var nodeData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var gridId = entity.Transform.GridID;
|
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID;
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var gridDict = _gridIndex.GetOrNew(gridId);
|
var gridDict = _gridIndex.GetOrNew(gridId);
|
||||||
var coords = entity.Transform.Coordinates;
|
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
|
|
||||||
// TODO: This probably shouldn't be capable of returning NaN...
|
// TODO: This probably shouldn't be capable of returning NaN...
|
||||||
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace Content.Client.Popups
|
|||||||
|
|
||||||
var position = Entity == null
|
var position = Entity == null
|
||||||
? InitialPos
|
? InitialPos
|
||||||
: (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - DesiredSize / 2;
|
: (_eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Entity.Uid).Coordinates).Position / UIScale) - DesiredSize / 2;
|
||||||
|
|
||||||
LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft)));
|
LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft)));
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Content.Client.Singularity
|
|||||||
|
|
||||||
if (!_singularities.Keys.Contains(singuloEntity.Uid) && SinguloQualifies(singuloEntity, currentEyeLoc))
|
if (!_singularities.Keys.Contains(singuloEntity.Uid) && SinguloQualifies(singuloEntity, currentEyeLoc))
|
||||||
{
|
{
|
||||||
_singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(singuloEntity.Transform.MapPosition.Position, distortion.Intensity, distortion.Falloff));
|
_singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(singuloEntity.Uid).MapPosition.Position, distortion.Intensity, distortion.Falloff));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ namespace Content.Client.Singularity
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var shaderInstance = _singularities[activeSinguloUid];
|
var shaderInstance = _singularities[activeSinguloUid];
|
||||||
shaderInstance.CurrentMapCoords = singuloEntity.Transform.MapPosition.Position;
|
shaderInstance.CurrentMapCoords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(singuloEntity.Uid).MapPosition.Position;
|
||||||
shaderInstance.Intensity = distortion.Intensity;
|
shaderInstance.Intensity = distortion.Intensity;
|
||||||
shaderInstance.Falloff = distortion.Falloff;
|
shaderInstance.Falloff = distortion.Falloff;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ namespace Content.Client.Singularity
|
|||||||
|
|
||||||
private bool SinguloQualifies(IEntity singuloEntity, MapCoordinates currentEyeLoc)
|
private bool SinguloQualifies(IEntity singuloEntity, MapCoordinates currentEyeLoc)
|
||||||
{
|
{
|
||||||
return singuloEntity.Transform.MapID == currentEyeLoc.MapId && singuloEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, singuloEntity.Transform.ParentUid, currentEyeLoc), MaxDist);
|
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(singuloEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(singuloEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(singuloEntity.Uid).ParentUid, currentEyeLoc), MaxDist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class SingularityShaderInstance
|
private sealed class SingularityShaderInstance
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Client.Spawners
|
|||||||
{
|
{
|
||||||
foreach (var proto in _prototypes)
|
foreach (var proto in _prototypes)
|
||||||
{
|
{
|
||||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(proto, Owner.Transform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(proto, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||||
_entity.Add(entity);
|
_entity.Add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Content.Client.StationEvents
|
|||||||
(
|
(
|
||||||
_baseShader.Duplicate(),
|
_baseShader.Duplicate(),
|
||||||
new RadiationShaderInstance(
|
new RadiationShaderInstance(
|
||||||
pulseEntity.Transform.MapPosition.Position,
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).MapPosition.Position,
|
||||||
pulse.Range,
|
pulse.Range,
|
||||||
pulse.StartTime,
|
pulse.StartTime,
|
||||||
pulse.EndTime
|
pulse.EndTime
|
||||||
@@ -111,7 +111,7 @@ namespace Content.Client.StationEvents
|
|||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<RadiationPulseComponent?>(pulseEntity.Uid, out var pulse))
|
IoCManager.Resolve<IEntityManager>().TryGetComponent<RadiationPulseComponent?>(pulseEntity.Uid, out var pulse))
|
||||||
{
|
{
|
||||||
var shaderInstance = _pulses[activePulseUid];
|
var shaderInstance = _pulses[activePulseUid];
|
||||||
shaderInstance.instance.CurrentMapCoords = pulseEntity.Transform.MapPosition.Position;
|
shaderInstance.instance.CurrentMapCoords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).MapPosition.Position;
|
||||||
shaderInstance.instance.Range = pulse.Range;
|
shaderInstance.instance.Range = pulse.Range;
|
||||||
} else {
|
} else {
|
||||||
_pulses[activePulseUid].shd.Dispose();
|
_pulses[activePulseUid].shd.Dispose();
|
||||||
@@ -123,7 +123,7 @@ namespace Content.Client.StationEvents
|
|||||||
|
|
||||||
private bool PulseQualifies(IEntity pulseEntity, MapCoordinates currentEyeLoc)
|
private bool PulseQualifies(IEntity pulseEntity, MapCoordinates currentEyeLoc)
|
||||||
{
|
{
|
||||||
return pulseEntity.Transform.MapID == currentEyeLoc.MapId && pulseEntity.Transform.Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, pulseEntity.Transform.ParentUid, currentEyeLoc), MaxDist);
|
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).ParentUid, currentEyeLoc), MaxDist);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed record RadiationShaderInstance(Vector2 CurrentMapCoords, float Range, TimeSpan Start, TimeSpan End)
|
private sealed record RadiationShaderInstance(Vector2 CurrentMapCoords, float Range, TimeSpan Start, TimeSpan End)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace Content.Client.Storage
|
|||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetEntity(entityId, out var entity))
|
if (IoCManager.Resolve<IEntityManager>().TryGetEntity(entityId, out var entity))
|
||||||
{
|
{
|
||||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.LocalPosition);
|
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).LocalPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,14 +59,14 @@ namespace Content.Client.Suspicion
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ExamineSystemShared.InRangeUnOccluded(ent.Transform.MapPosition, ally.Transform.MapPosition, 15,
|
if (!ExamineSystemShared.InRangeUnOccluded(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent.Uid).MapPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ally.Uid).MapPosition, 15,
|
||||||
entity => entity == ent || entity == ally))
|
entity => entity == ent || entity == ally))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not on the same map, continue
|
// if not on the same map, continue
|
||||||
if (physics.Owner.Transform.MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer())
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physics.Owner.Uid).MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,12 +155,12 @@ namespace Content.Client.Verbs
|
|||||||
// Remove any entities that do not have LOS
|
// Remove any entities that do not have LOS
|
||||||
if ((visibility & MenuVisibility.NoFov) == 0)
|
if ((visibility & MenuVisibility.NoFov) == 0)
|
||||||
{
|
{
|
||||||
var playerPos = player.Transform.MapPosition;
|
var playerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition;
|
||||||
foreach (var entity in entities.ToList())
|
foreach (var entity in entities.ToList())
|
||||||
{
|
{
|
||||||
if (!ExamineSystemShared.InRangeUnOccluded(
|
if (!ExamineSystemShared.InRangeUnOccluded(
|
||||||
playerPos,
|
playerPos,
|
||||||
entity.Transform.MapPosition,
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapPosition,
|
||||||
ExamineSystemShared.ExamineRange,
|
ExamineSystemShared.ExamineRange,
|
||||||
null))
|
null))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -223,8 +223,8 @@ namespace Content.Client.Viewport
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var transX = x.clicked.Transform;
|
var transX = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(x.clicked.Uid);
|
||||||
var transY = y.clicked.Transform;
|
var transY = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(y.clicked.Uid);
|
||||||
val = transX.Coordinates.Y.CompareTo(transY.Coordinates.Y);
|
val = transX.Coordinates.Y.CompareTo(transY.Coordinates.Y);
|
||||||
if (val != 0)
|
if (val != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ namespace Content.Client.Wall.Components
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
_overlayEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
|
_overlayEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity("LowWallOverlay", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||||
_overlayEntity.Transform.AttachParent(Owner);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_overlayEntity.Uid).AttachParent(Owner);
|
||||||
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_overlayEntity.Uid).LocalPosition = Vector2.Zero;
|
||||||
|
|
||||||
_overlaySprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(_overlayEntity.Uid);
|
_overlaySprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(_overlayEntity.Uid);
|
||||||
|
|
||||||
@@ -74,13 +74,13 @@ namespace Content.Client.Wall.Components
|
|||||||
{
|
{
|
||||||
base.CalculateNewSprite();
|
base.CalculateNewSprite();
|
||||||
|
|
||||||
if (Sprite == null || !Owner.Transform.Anchored || _overlaySprite == null)
|
if (Sprite == null || !IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored || _overlaySprite == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var grid = _mapManager.GetGrid(Owner.Transform.GridID);
|
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||||
var coords = Owner.Transform.Coordinates;
|
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||||
|
|
||||||
var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North));
|
var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North));
|
||||||
var (ne, nel) = MatchingWall(grid.GetInDir(coords, Direction.NorthEast));
|
var (ne, nel) = MatchingWall(grid.GetInDir(coords, Direction.NorthEast));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Client.Weapons.Melee.Components
|
|||||||
_sprite?.AddLayer(new RSI.StateId(prototype.State));
|
_sprite?.AddLayer(new RSI.StateId(prototype.State));
|
||||||
_baseAngle = baseAngle;
|
_baseAngle = baseAngle;
|
||||||
if(followAttacker)
|
if(followAttacker)
|
||||||
Owner.Transform.AttachParent(attacker);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).AttachParent(attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Update(float frameTime)
|
internal void Update(float frameTime)
|
||||||
@@ -55,12 +55,12 @@ namespace Content.Client.Weapons.Melee.Components
|
|||||||
{
|
{
|
||||||
case WeaponArcType.Slash:
|
case WeaponArcType.Slash:
|
||||||
var angle = Angle.FromDegrees(_meleeWeaponAnimation.Width)/2;
|
var angle = Angle.FromDegrees(_meleeWeaponAnimation.Width)/2;
|
||||||
Owner.Transform.WorldRotation =
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).WorldRotation =
|
||||||
_baseAngle + Angle.Lerp(-angle, angle, (float) (_timer / _meleeWeaponAnimation.Length.TotalSeconds));
|
_baseAngle + Angle.Lerp(-angle, angle, (float) (_timer / _meleeWeaponAnimation.Length.TotalSeconds));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WeaponArcType.Poke:
|
case WeaponArcType.Poke:
|
||||||
Owner.Transform.WorldRotation = _baseAngle;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).WorldRotation = _baseAngle;
|
||||||
|
|
||||||
if (_sprite != null)
|
if (_sprite != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace Content.Client.Weapons.Melee
|
|||||||
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
||||||
lunge.SetData(msg.Angle);
|
lunge.SetData(msg.Angle);
|
||||||
|
|
||||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attacker.Uid).Coordinates);
|
||||||
entity.Transform.LocalRotation = msg.Angle;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).LocalRotation = msg.Angle;
|
||||||
|
|
||||||
var weaponArcAnimation = IoCManager.Resolve<IEntityManager>().GetComponent<MeleeWeaponArcAnimationComponent>(entity.Uid);
|
var weaponArcAnimation = IoCManager.Resolve<IEntityManager>().GetComponent<MeleeWeaponArcAnimationComponent>(entity.Uid);
|
||||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
||||||
@@ -73,7 +73,7 @@ namespace Content.Client.Weapons.Melee
|
|||||||
{
|
{
|
||||||
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
||||||
RsiState = sourceSprite.LayerGetState(0).Name,
|
RsiState = sourceSprite.LayerGetState(0).Name,
|
||||||
Coordinates = attacker.Transform.Coordinates,
|
Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attacker.Uid).Coordinates,
|
||||||
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
||||||
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
||||||
Velocity = msg.Angle.ToWorldVec(),
|
Velocity = msg.Angle.ToWorldVec(),
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.False(actionBlocker.CanMove(human.Uid));
|
Assert.False(actionBlocker.CanMove(human.Uid));
|
||||||
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
|
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
|
||||||
Assert.False(standingState.Down(human.Uid));
|
Assert.False(standingState.Down(human.Uid));
|
||||||
Assert.That((human.Transform.WorldPosition - chair.Transform.WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
Assert.That((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
||||||
|
|
||||||
// Side effects of buckling for the strap
|
// Side effects of buckling for the strap
|
||||||
Assert.That(strap.BuckledEntities, Does.Contain(human));
|
Assert.That(strap.BuckledEntities, Does.Contain(human));
|
||||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.False(buckle.Buckled);
|
Assert.False(buckle.Buckled);
|
||||||
|
|
||||||
// Move away from the chair
|
// Move away from the chair
|
||||||
human.Transform.WorldPosition += (1000, 1000);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (1000, 1000);
|
||||||
|
|
||||||
// Out of range
|
// Out of range
|
||||||
Assert.False(buckle.TryBuckle(human, chair));
|
Assert.False(buckle.TryBuckle(human, chair));
|
||||||
@@ -179,7 +179,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.False(buckle.ToggleBuckle(human, chair));
|
Assert.False(buckle.ToggleBuckle(human, chair));
|
||||||
|
|
||||||
// Move near the chair
|
// Move near the chair
|
||||||
human.Transform.WorldPosition = chair.Transform.WorldPosition + (0.5f, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition + (0.5f, 0);
|
||||||
|
|
||||||
// In range
|
// In range
|
||||||
Assert.True(buckle.TryBuckle(human, chair));
|
Assert.True(buckle.TryBuckle(human, chair));
|
||||||
@@ -200,7 +200,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.True(buckle.TryBuckle(human, chair));
|
Assert.True(buckle.TryBuckle(human, chair));
|
||||||
|
|
||||||
// Move away from the chair
|
// Move away from the chair
|
||||||
human.Transform.WorldPosition += (1, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (1, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitRunTicks(1);
|
await server.WaitRunTicks(1);
|
||||||
@@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.True(buckle.Buckled);
|
Assert.True(buckle.Buckled);
|
||||||
|
|
||||||
// Move the buckled entity away
|
// Move the buckled entity away
|
||||||
human.Transform.WorldPosition += (100, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (100, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
await WaitUntil(server, () => !buckle.Buckled, 10);
|
await WaitUntil(server, () => !buckle.Buckled, 10);
|
||||||
@@ -343,7 +343,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// Move the now unbuckled entity back onto the chair
|
// Move the now unbuckled entity back onto the chair
|
||||||
human.Transform.WorldPosition -= (100, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition -= (100, 0);
|
||||||
|
|
||||||
// Buckle
|
// Buckle
|
||||||
Assert.True(buckle.TryBuckle(human, chair));
|
Assert.True(buckle.TryBuckle(human, chair));
|
||||||
|
|||||||
@@ -77,10 +77,11 @@ namespace Content.IntegrationTests.Tests
|
|||||||
await _server.WaitPost(() =>
|
await _server.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var gridEnt = mapManager.GetAllGrids().First().GridEntityId;
|
var gridEnt = mapManager.GetAllGrids().First().GridEntityId;
|
||||||
worldPos = serverEntManager.GetEntity(gridEnt).Transform.WorldPosition;
|
IEntity tempQualifier = serverEntManager.GetEntity(gridEnt);
|
||||||
|
worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid).WorldPosition;
|
||||||
|
|
||||||
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
||||||
ent.Transform.LocalRotation = angle;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent.Uid).LocalRotation = angle;
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent.Uid).Scale = (scale, scale);
|
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent.Uid).Scale = (scale, scale);
|
||||||
entity = ent.Uid;
|
entity = ent.Uid;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var coordinates = sDestructibleEntity.Transform.Coordinates;
|
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sDestructibleEntity.Uid).Coordinates;
|
||||||
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
|
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
|
||||||
DamageSpecifier bruteDamage = new(bruteDamageGroup,50);
|
DamageSpecifier bruteDamage = new(bruteDamageGroup,50);
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||||
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
||||||
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
||||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
|
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalUnit.Uid).MapPosition);
|
||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
ref DisposalUnitComponent? comp = ref unit!;
|
ref DisposalUnitComponent? comp = ref unit!;
|
||||||
@@ -151,14 +151,14 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk.Uid));
|
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk.Uid));
|
||||||
|
|
||||||
// Can't insert, unanchored and unpowered
|
// Can't insert, unanchored and unpowered
|
||||||
unit.Owner.Transform.Anchored = false;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).Anchored = false;
|
||||||
UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk);
|
UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// Anchor the disposal unit
|
// Anchor the disposal unit
|
||||||
unit.Owner.Transform.Anchored = true;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).Anchored = true;
|
||||||
|
|
||||||
// No power
|
// No power
|
||||||
Assert.False(unit.Powered);
|
Assert.False(unit.Powered);
|
||||||
@@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// Move the disposal trunk away
|
// Move the disposal trunk away
|
||||||
disposalTrunk.Transform.WorldPosition += (1, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).WorldPosition += (1, 0);
|
||||||
|
|
||||||
// Fail to flush with a mob and an item
|
// Fail to flush with a mob and an item
|
||||||
Flush(unit, false, human, wrench);
|
Flush(unit, false, human, wrench);
|
||||||
@@ -182,7 +182,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// Move the disposal trunk back
|
// Move the disposal trunk back
|
||||||
disposalTrunk.Transform.WorldPosition -= (1, 0);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).WorldPosition -= (1, 0);
|
||||||
|
|
||||||
// Fail to flush with a mob and an item, no power
|
// Fail to flush with a mob and an item, no power
|
||||||
Flush(unit, false, human, wrench);
|
Flush(unit, false, human, wrench);
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
|
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
|
||||||
|
|
||||||
// Blocked by the airlock
|
// Blocked by the airlock
|
||||||
await server.WaitAssertion(() => Assert.That(Math.Abs(physicsDummy.Transform.MapPosition.X - 1) > 0.01f));
|
await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physicsDummy.Uid).MapPosition.X - 1) > 0.01f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
|||||||
cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||||
secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||||
|
|
||||||
human.Transform.WorldPosition = otherHuman.Transform.WorldPosition;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(otherHuman.Uid).WorldPosition;
|
||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
ref CuffableComponent? comp = ref cuffed!;
|
ref CuffableComponent? comp = ref cuffed!;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
// drop the item, and the item actions should go away
|
// drop the item, and the item actions should go away
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid)
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid)
|
||||||
.TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false);
|
.TryDropEntity(serverFlashlight, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(serverPlayerEnt.Uid).Coordinates, false);
|
||||||
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
|
|
||||||
// Now let's make the player enter a climbing transitioning state.
|
// Now let's make the player enter a climbing transitioning state.
|
||||||
climbing.IsClimbing = true;
|
climbing.IsClimbing = true;
|
||||||
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
climbing.TryMoveTo(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(table.Uid).WorldPosition);
|
||||||
var body = IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(human.Uid);
|
var body = IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(human.Uid);
|
||||||
// TODO: Check it's climbing
|
// TODO: Check it's climbing
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
|||||||
// No gravity without a gravity generator
|
// No gravity without a gravity generator
|
||||||
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
||||||
|
|
||||||
entityManager.SpawnEntity("GravityGeneratorDummy", human.Transform.Coordinates);
|
entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).Coordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Let WeightlessSystem and GravitySystem tick
|
// Let WeightlessSystem and GravitySystem tick
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
private static bool IsDescendant(IEntity descendant, IEntity parent)
|
private static bool IsDescendant(IEntity descendant, IEntity parent)
|
||||||
{
|
{
|
||||||
var tmpParent = descendant.Transform.Parent;
|
var tmpParent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(descendant.Uid).Parent;
|
||||||
while (tmpParent != null)
|
while (tmpParent != null)
|
||||||
{
|
{
|
||||||
if (tmpParent.Owner == parent)
|
if (tmpParent.Owner == parent)
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(attack);
|
Assert.That(attack);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
@@ -98,7 +98,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing);
|
Assert.That(interactUsing);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
target = entityManager.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId));
|
target = entityManager.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId));
|
||||||
item = entityManager.SpawnEntity(null, coords);
|
item = entityManager.SpawnEntity(null, coords);
|
||||||
item.EnsureComponent<ItemComponent>();
|
item.EnsureComponent<ItemComponent>();
|
||||||
wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), user.Transform.MapID));
|
wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).MapID));
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitRunTicks(1);
|
await server.WaitRunTicks(1);
|
||||||
@@ -161,8 +161,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(attack, Is.False);
|
Assert.That(attack, Is.False);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand, Is.False);
|
Assert.That(interactHand, Is.False);
|
||||||
@@ -170,7 +170,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -230,8 +230,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(attack);
|
Assert.That(attack);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
@@ -239,7 +239,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing);
|
Assert.That(interactUsing);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -300,8 +300,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(attack, Is.False);
|
Assert.That(attack, Is.False);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand, Is.False);
|
Assert.That(interactHand, Is.False);
|
||||||
@@ -309,7 +309,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -373,20 +373,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
Assert.That(container.Insert(user));
|
Assert.That(container.Insert(user));
|
||||||
Assert.That(user.Transform.Parent.Owner, Is.EqualTo(containerEntity));
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).Parent.Owner, Is.EqualTo(containerEntity));
|
||||||
|
|
||||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); attack = true; };
|
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); attack = true; };
|
||||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; };
|
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; };
|
||||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; };
|
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; };
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, target.Transform.Coordinates, false, target.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(attack, Is.False);
|
Assert.That(attack, Is.False);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand, Is.False);
|
Assert.That(interactHand, Is.False);
|
||||||
|
|
||||||
interactionSystem.DoAttack(user, containerEntity.Transform.Coordinates, false, containerEntity.Uid);
|
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, false, containerEntity.Uid);
|
||||||
interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, containerEntity.Uid);
|
||||||
Assert.That(attack);
|
Assert.That(attack);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
@@ -394,10 +394,10 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid);
|
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, containerEntity.Uid);
|
||||||
Assert.That(interactUsing, Is.True);
|
Assert.That(interactUsing, Is.True);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Interaction.Helpers;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
@@ -51,9 +52,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
origin = entityManager.SpawnEntity(HumanId, coordinates);
|
origin = entityManager.SpawnEntity(HumanId, coordinates);
|
||||||
other = entityManager.SpawnEntity(HumanId, coordinates);
|
other = entityManager.SpawnEntity(HumanId, coordinates);
|
||||||
container = ContainerHelpers.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
container = ContainerHelpers.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||||
component = other.Transform;
|
component = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid);
|
||||||
entityCoordinates = other.Transform.Coordinates;
|
entityCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).Coordinates;
|
||||||
mapCoordinates = other.Transform.MapPosition;
|
mapCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
@@ -82,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
|
|
||||||
|
|
||||||
// Move them slightly apart
|
// Move them slightly apart
|
||||||
origin.Transform.LocalPosition += _interactionRangeDivided15X;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||||
|
|
||||||
// Entity <-> Entity
|
// Entity <-> Entity
|
||||||
Assert.True(origin.InRangeUnobstructed(other));
|
Assert.True(origin.InRangeUnobstructed(other));
|
||||||
@@ -106,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
|
|
||||||
|
|
||||||
// Move them out of range
|
// Move them out of range
|
||||||
origin.Transform.LocalPosition += _interactionRangeDivided15X;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||||
|
|
||||||
// Entity <-> Entity
|
// Entity <-> Entity
|
||||||
Assert.False(origin.InRangeUnobstructed(other));
|
Assert.False(origin.InRangeUnobstructed(other));
|
||||||
|
|||||||
@@ -70,12 +70,12 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
Assert.NotNull(id);
|
Assert.NotNull(id);
|
||||||
|
|
||||||
// Put PDA in hand
|
// Put PDA in hand
|
||||||
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition);
|
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||||
var pdaItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(dummyPda.Uid);
|
var pdaItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(dummyPda.Uid);
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(pdaItemComponent);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(pdaItemComponent);
|
||||||
|
|
||||||
var pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda.Uid);
|
var pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda.Uid);
|
||||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||||
|
|
||||||
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda.Uid);
|
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda.Uid);
|
||||||
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
||||||
@@ -90,7 +90,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
Assert.That(id, Is.EqualTo(pdaContainedId));
|
Assert.That(id, Is.EqualTo(pdaContainedId));
|
||||||
|
|
||||||
// Put ID card in hand
|
// Put ID card in hand
|
||||||
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||||
var idItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(idDummy.Uid);
|
var idItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(idDummy.Uid);
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(idItemComponent);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(idItemComponent);
|
||||||
|
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -567,7 +567,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -643,7 +643,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
|
|
||||||
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||||
@@ -730,7 +730,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
|
|
||||||
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||||
@@ -800,7 +800,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
}
|
}
|
||||||
|
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
@@ -879,7 +879,7 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
||||||
|
|
||||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery.Uid);
|
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery.Uid);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Server.Maps;
|
using Robust.Server.Maps;
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -39,13 +40,13 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
||||||
mapGridEnt.Transform.WorldPosition = new Vector2(10, 10);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).WorldPosition = new Vector2(10, 10);
|
||||||
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512));
|
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var mapGrid = mapManager.CreateGrid(mapId);
|
var mapGrid = mapManager.CreateGrid(mapId);
|
||||||
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
||||||
mapGridEnt.Transform.WorldPosition = new Vector2(-8, -8);
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).WorldPosition = new Vector2(-8, -8);
|
||||||
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511));
|
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent));
|
||||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent));
|
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent));
|
||||||
Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic));
|
Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic));
|
||||||
Assert.That(gridEnt.Transform.LocalPosition, Is.EqualTo(Vector2.Zero));
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).LocalPosition, Is.EqualTo(Vector2.Zero));
|
||||||
physicsComponent.ApplyLinearImpulse(Vector2.One);
|
physicsComponent.ApplyLinearImpulse(Vector2.One);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
Assert.That(gridEnt?.Transform.LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
Assert.That<Vector2?>((gridEnt != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Physics;
|
|||||||
using Content.Shared.Spawning;
|
using Content.Shared.Spawning;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
|||||||
{
|
{
|
||||||
var grid = GetMainGrid(sMapManager);
|
var grid = GetMainGrid(sMapManager);
|
||||||
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
||||||
var gridPos = gridEnt.Transform.WorldPosition;
|
var gridPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).WorldPosition;
|
||||||
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
|
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
|
||||||
|
|
||||||
// Nothing blocking it, only entity is the grid
|
// Nothing blocking it, only entity is the grid
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ namespace Content.Server.AI.EntitySystems
|
|||||||
{
|
{
|
||||||
if ((component.Factions & hostile) == 0)
|
if ((component.Factions & hostile) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (component.Owner.Transform.MapID != entity.Transform.MapID)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID)
|
||||||
continue;
|
continue;
|
||||||
if (!component.Owner.Transform.MapPosition.InRange(entity.Transform.MapPosition, range))
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).MapPosition.InRange(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapPosition, range))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
yield return component.Owner;
|
yield return component.Owner;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
var meleeWeapon = hands.GetActiveHand.Owner;
|
var meleeWeapon = hands.GetActiveHand.Owner;
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(meleeWeapon.Uid, out MeleeWeaponComponent? meleeWeaponComponent);
|
IoCManager.Resolve<IEntityManager>().TryGetComponent(meleeWeapon.Uid, out MeleeWeaponComponent? meleeWeaponComponent);
|
||||||
|
|
||||||
if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length >
|
if ((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).Coordinates.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_owner.Uid).Coordinates.Position).Length >
|
||||||
meleeWeaponComponent?.Range)
|
meleeWeaponComponent?.Range)
|
||||||
{
|
{
|
||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
@@ -78,7 +78,7 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
|
|
||||||
interactionSystem.AiUseInteraction(_owner, _target.Transform.Coordinates, _target.Uid);
|
interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).Coordinates, _target.Uid);
|
||||||
_elapsedTime += frameTime;
|
_elapsedTime += frameTime;
|
||||||
return Outcome.Continuing;
|
return Outcome.Continuing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,14 +76,14 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length >
|
if ((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).Coordinates.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_owner.Uid).Coordinates.Position).Length >
|
||||||
_unarmedCombat.Range)
|
_unarmedCombat.Range)
|
||||||
{
|
{
|
||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
interactionSystem.AiUseInteraction(_owner, _target.Transform.Coordinates, _target.Uid);
|
interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).Coordinates, _target.Uid);
|
||||||
_elapsedTime += frameTime;
|
_elapsedTime += frameTime;
|
||||||
return Outcome.Continuing;
|
return Outcome.Continuing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.AI.Operators.Inventory
|
|||||||
|
|
||||||
public override Outcome Execute(float frameTime)
|
public override Outcome Execute(float frameTime)
|
||||||
{
|
{
|
||||||
if (_useTarget.Transform.GridID != _owner.Transform.GridID)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_useTarget.Uid).GridID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_owner.Uid).GridID)
|
||||||
{
|
{
|
||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ namespace Content.Server.AI.Operators.Inventory
|
|||||||
|
|
||||||
// Click on da thing
|
// Click on da thing
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
interactionSystem.AiUseInteraction(_owner, _useTarget.Transform.Coordinates, _useTarget.Uid);
|
interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_useTarget.Uid).Coordinates, _useTarget.Uid);
|
||||||
|
|
||||||
return Outcome.Success;
|
return Outcome.Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f)
|
public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f)
|
||||||
{
|
{
|
||||||
// TODO: Handle this gracefully instead of just failing.
|
// TODO: Handle this gracefully instead of just failing.
|
||||||
if (!target.Transform.GridID.IsValid())
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).GridID.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var targetTile = _mapManager.GetGrid(target.Transform.GridID).GetTileRef(target.Transform.Coordinates);
|
var targetTile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates);
|
||||||
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
||||||
|
|
||||||
var collisionMask = 0;
|
var collisionMask = 0;
|
||||||
@@ -210,12 +210,12 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
|
|
||||||
public bool CanAccess(IEntity entity, PathfindingNode targetNode)
|
public bool CanAccess(IEntity entity, PathfindingNode targetNode)
|
||||||
{
|
{
|
||||||
if (entity.Transform.GridID != targetNode.TileRef.GridIndex)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID != targetNode.TileRef.GridIndex)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
var entityTile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||||
var entityRegion = GetRegion(entityNode);
|
var entityRegion = GetRegion(entityNode);
|
||||||
var targetRegion = GetRegion(targetNode);
|
var targetRegion = GetRegion(targetNode);
|
||||||
@@ -425,12 +425,12 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PathfindingRegion? GetRegion(IEntity entity)
|
public PathfindingRegion? GetRegion(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.Transform.GridID.IsValid())
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID.IsValid())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
var entityTile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||||
return GetRegion(entityNode);
|
return GetRegion(entityNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
|
|
||||||
public static bool IsRelevant(IEntity entity, IPhysBody physicsComponent)
|
public static bool IsRelevant(IEntity entity, IPhysBody physicsComponent)
|
||||||
{
|
{
|
||||||
if (entity.Transform.GridID == GridId.Invalid ||
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID == GridId.Invalid ||
|
||||||
(PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0)
|
(PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PathfindingNode GetNode(IEntity entity)
|
public PathfindingNode GetNode(IEntity entity)
|
||||||
{
|
{
|
||||||
var tile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
var tile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
return GetNode(tile);
|
return GetNode(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,8 +273,8 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var grid = _mapManager.GetGrid(entity.Transform.GridID);
|
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID);
|
||||||
var tileRef = grid.GetTileRef(entity.Transform.Coordinates);
|
var tileRef = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
|
|
||||||
var chunk = GetChunk(tileRef);
|
var chunk = GetChunk(tileRef);
|
||||||
var node = chunk.GetNode(tileRef);
|
var node = chunk.GetNode(tileRef);
|
||||||
@@ -315,9 +315,9 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Memory leak protection until grid parenting confirmed fix / you REALLY need the performance
|
// Memory leak protection until grid parenting confirmed fix / you REALLY need the performance
|
||||||
var gridBounds = _mapManager.GetGrid(moveEvent.Sender.Transform.GridID).WorldBounds;
|
var gridBounds = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(moveEvent.Sender.Uid).GridID).WorldBounds;
|
||||||
|
|
||||||
if (!gridBounds.Contains(moveEvent.Sender.Transform.WorldPosition))
|
if (!gridBounds.Contains(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(moveEvent.Sender.Uid).WorldPosition))
|
||||||
{
|
{
|
||||||
HandleEntityRemove(moveEvent.Sender);
|
HandleEntityRemove(moveEvent.Sender);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ namespace Content.Server.AI.Steering
|
|||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out AiControllerComponent? controller) ||
|
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out AiControllerComponent? controller) ||
|
||||||
!EntitySystem.Get<ActionBlockerSystem>().CanMove(entity.Uid) ||
|
!EntitySystem.Get<ActionBlockerSystem>().CanMove(entity.Uid) ||
|
||||||
!entity.Transform.GridID.IsValid())
|
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID.IsValid())
|
||||||
{
|
{
|
||||||
return SteeringStatus.NoPath;
|
return SteeringStatus.NoPath;
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@ namespace Content.Server.AI.Steering
|
|||||||
return SteeringStatus.NoPath;
|
return SteeringStatus.NoPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pauseManager.IsGridPaused(entity.Transform.GridID))
|
if (_pauseManager.IsGridPaused(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID))
|
||||||
{
|
{
|
||||||
controller.VelocityDir = Vector2.Zero;
|
controller.VelocityDir = Vector2.Zero;
|
||||||
return SteeringStatus.Pending;
|
return SteeringStatus.Pending;
|
||||||
@@ -272,14 +272,14 @@ namespace Content.Server.AI.Steering
|
|||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
// Check if we can even arrive -> Currently only samegrid movement supported
|
// Check if we can even arrive -> Currently only samegrid movement supported
|
||||||
if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(EntityManager))
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID != steeringRequest.TargetGrid.GetGridId(EntityManager))
|
||||||
{
|
{
|
||||||
controller.VelocityDir = Vector2.Zero;
|
controller.VelocityDir = Vector2.Zero;
|
||||||
return SteeringStatus.NoPath;
|
return SteeringStatus.NoPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have arrived
|
// Check if we have arrived
|
||||||
var targetDistance = (entity.Transform.MapPosition.Position - steeringRequest.TargetMap.Position).Length;
|
var targetDistance = (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapPosition.Position - steeringRequest.TargetMap.Position).Length;
|
||||||
steeringRequest.TimeUntilInteractionCheck -= frameTime;
|
steeringRequest.TimeUntilInteractionCheck -= frameTime;
|
||||||
|
|
||||||
if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f)
|
if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f)
|
||||||
@@ -416,8 +416,8 @@ namespace Content.Server.AI.Steering
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancelToken = new CancellationTokenSource();
|
var cancelToken = new CancellationTokenSource();
|
||||||
var gridManager = _mapManager.GetGrid(entity.Transform.GridID);
|
var gridManager = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID);
|
||||||
var startTile = gridManager.GetTileRef(entity.Transform.Coordinates);
|
var startTile = gridManager.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid);
|
var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid);
|
||||||
var collisionMask = 0;
|
var collisionMask = 0;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out IPhysBody? physics))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out IPhysBody? physics))
|
||||||
@@ -447,7 +447,7 @@ namespace Content.Server.AI.Steering
|
|||||||
{
|
{
|
||||||
_pathfindingRequests.Remove(entity);
|
_pathfindingRequests.Remove(entity);
|
||||||
|
|
||||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates);
|
var entityTile = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID).GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||||
var tile = path.Dequeue();
|
var tile = path.Dequeue();
|
||||||
var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile);
|
var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile);
|
||||||
|
|
||||||
@@ -485,7 +485,7 @@ namespace Content.Server.AI.Steering
|
|||||||
// If no tiles left just move towards the target (if we're close)
|
// If no tiles left just move towards the target (if we're close)
|
||||||
if (!_paths.ContainsKey(entity) || _paths[entity].Count == 0)
|
if (!_paths.ContainsKey(entity) || _paths[entity].Count == 0)
|
||||||
{
|
{
|
||||||
if ((steeringRequest.TargetGrid.Position - entity.Transform.Coordinates.Position).Length <= 2.0f)
|
if ((steeringRequest.TargetGrid.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.Position).Length <= 2.0f)
|
||||||
{
|
{
|
||||||
return steeringRequest.TargetGrid;
|
return steeringRequest.TargetGrid;
|
||||||
}
|
}
|
||||||
@@ -495,7 +495,7 @@ namespace Content.Server.AI.Steering
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_nextGrid.TryGetValue(entity, out var nextGrid) ||
|
if (!_nextGrid.TryGetValue(entity, out var nextGrid) ||
|
||||||
(nextGrid.Position - entity.Transform.Coordinates.Position).Length <= TileTolerance)
|
(nextGrid.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.Position).Length <= TileTolerance)
|
||||||
{
|
{
|
||||||
UpdateGridCache(entity);
|
UpdateGridCache(entity);
|
||||||
nextGrid = _nextGrid[entity];
|
nextGrid = _nextGrid[entity];
|
||||||
@@ -514,7 +514,7 @@ namespace Content.Server.AI.Steering
|
|||||||
{
|
{
|
||||||
if (_paths[entity].Count == 0) return;
|
if (_paths[entity].Count == 0) return;
|
||||||
var nextTile = dequeue ? _paths[entity].Dequeue() : _paths[entity].Peek();
|
var nextTile = dequeue ? _paths[entity].Dequeue() : _paths[entity].Peek();
|
||||||
var nextGrid = _mapManager.GetGrid(entity.Transform.GridID).GridTileToLocal(nextTile.GridIndices);
|
var nextGrid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID).GridTileToLocal(nextTile.GridIndices);
|
||||||
_nextGrid[entity] = nextGrid;
|
_nextGrid[entity] = nextGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,12 +526,12 @@ namespace Content.Server.AI.Steering
|
|||||||
{
|
{
|
||||||
if (!_stuckPositions.TryGetValue(entity, out var stuckPosition))
|
if (!_stuckPositions.TryGetValue(entity, out var stuckPosition))
|
||||||
{
|
{
|
||||||
_stuckPositions[entity] = entity.Transform.Coordinates;
|
_stuckPositions[entity] = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
_stuckCounter[entity] = 0;
|
_stuckCounter[entity] = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entity.Transform.Coordinates.Position - stuckPosition.Position).Length <= 1.0f)
|
if ((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.Position - stuckPosition.Position).Length <= 1.0f)
|
||||||
{
|
{
|
||||||
_stuckCounter.TryGetValue(entity, out var stuckCount);
|
_stuckCounter.TryGetValue(entity, out var stuckCount);
|
||||||
_stuckCounter[entity] = stuckCount + 1;
|
_stuckCounter[entity] = stuckCount + 1;
|
||||||
@@ -539,7 +539,7 @@ namespace Content.Server.AI.Steering
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No longer stuck
|
// No longer stuck
|
||||||
_stuckPositions[entity] = entity.Transform.Coordinates;
|
_stuckPositions[entity] = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
_stuckCounter[entity] = 0;
|
_stuckCounter[entity] = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -565,7 +565,7 @@ namespace Content.Server.AI.Steering
|
|||||||
private Vector2 Seek(IEntity entity, EntityCoordinates grid)
|
private Vector2 Seek(IEntity entity, EntityCoordinates grid)
|
||||||
{
|
{
|
||||||
// is-even much
|
// is-even much
|
||||||
var entityPos = entity.Transform.Coordinates;
|
var entityPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
return entityPos == grid
|
return entityPos == grid
|
||||||
? Vector2.Zero
|
? Vector2.Zero
|
||||||
: (grid.Position - entityPos.Position).Normalized;
|
: (grid.Position - entityPos.Position).Normalized;
|
||||||
@@ -580,7 +580,7 @@ namespace Content.Server.AI.Steering
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Vector2 Arrival(IEntity entity, EntityCoordinates grid, float slowingDistance = 1.0f)
|
private Vector2 Arrival(IEntity entity, EntityCoordinates grid, float slowingDistance = 1.0f)
|
||||||
{
|
{
|
||||||
var entityPos = entity.Transform.Coordinates;
|
var entityPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
DebugTools.Assert(slowingDistance > 0.0f);
|
DebugTools.Assert(slowingDistance > 0.0f);
|
||||||
if (entityPos == grid)
|
if (entityPos == grid)
|
||||||
{
|
{
|
||||||
@@ -599,8 +599,8 @@ namespace Content.Server.AI.Steering
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private Vector2 Pursuit(IEntity entity, IEntity target)
|
private Vector2 Pursuit(IEntity entity, IEntity target)
|
||||||
{
|
{
|
||||||
var entityPos = entity.Transform.Coordinates;
|
var entityPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
var targetPos = target.Transform.Coordinates;
|
var targetPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates;
|
||||||
if (entityPos == targetPos)
|
if (entityPos == targetPos)
|
||||||
{
|
{
|
||||||
return Vector2.Zero;
|
return Vector2.Zero;
|
||||||
@@ -636,8 +636,8 @@ namespace Content.Server.AI.Steering
|
|||||||
var avoidanceVector = Vector2.Zero;
|
var avoidanceVector = Vector2.Zero;
|
||||||
var checkTiles = new HashSet<TileRef>();
|
var checkTiles = new HashSet<TileRef>();
|
||||||
var avoidTiles = new HashSet<TileRef>();
|
var avoidTiles = new HashSet<TileRef>();
|
||||||
var entityGridCoords = entity.Transform.Coordinates;
|
var entityGridCoords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates;
|
||||||
var grid = _mapManager.GetGrid(entity.Transform.GridID);
|
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID);
|
||||||
var currentTile = grid.GetTileRef(entityGridCoords);
|
var currentTile = grid.GetTileRef(entityGridCoords);
|
||||||
var halfwayTile = grid.GetTileRef(entityGridCoords.Offset(direction / 2));
|
var halfwayTile = grid.GetTileRef(entityGridCoords.Offset(direction / 2));
|
||||||
var nextTile = grid.GetTileRef(entityGridCoords.Offset(direction));
|
var nextTile = grid.GetTileRef(entityGridCoords.Offset(direction));
|
||||||
@@ -671,7 +671,7 @@ namespace Content.Server.AI.Steering
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var centerGrid = physicsEntity.Transform.Coordinates;
|
var centerGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physicsEntity.Uid).Coordinates;
|
||||||
// Check how close we are to center of tile and get the inverse; if we're closer this is stronger
|
// Check how close we are to center of tile and get the inverse; if we're closer this is stronger
|
||||||
var additionalVector = (centerGrid.Position - entityGridCoords.Position);
|
var additionalVector = (centerGrid.Position - entityGridCoords.Position);
|
||||||
var distance = additionalVector.Length;
|
var distance = additionalVector.Length;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.AI.Steering
|
namespace Content.Server.AI.Steering
|
||||||
@@ -6,8 +7,8 @@ namespace Content.Server.AI.Steering
|
|||||||
public sealed class EntityTargetSteeringRequest : IAiSteeringRequest
|
public sealed class EntityTargetSteeringRequest : IAiSteeringRequest
|
||||||
{
|
{
|
||||||
public SteeringStatus Status { get; set; } = SteeringStatus.Pending;
|
public SteeringStatus Status { get; set; } = SteeringStatus.Pending;
|
||||||
public MapCoordinates TargetMap => _target.Transform.MapPosition;
|
public MapCoordinates TargetMap => IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).MapPosition;
|
||||||
public EntityCoordinates TargetGrid => _target.Transform.Coordinates;
|
public EntityCoordinates TargetGrid => IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_target.Uid).Coordinates;
|
||||||
public IEntity Target => _target;
|
public IEntity Target => _target;
|
||||||
private readonly IEntity _target;
|
private readonly IEntity _target;
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
|
|||||||
|
|
||||||
var targetNode = robustRandom.Pick(reachableNodes);
|
var targetNode = robustRandom.Pick(reachableNodes);
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var grid = mapManager.GetGrid(Owner.Transform.GridID);
|
var grid = mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||||
var targetGrid = grid.GridTileToLocal(targetNode.TileRef.GridIndices);
|
var targetGrid = grid.GridTileToLocal(targetNode.TileRef.GridIndices);
|
||||||
|
|
||||||
return targetGrid;
|
return targetGrid;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace Content.Server.AI.Utility.Actions.Test
|
|||||||
|
|
||||||
public override void SetupOperators(Blackboard context)
|
public override void SetupOperators(Blackboard context)
|
||||||
{
|
{
|
||||||
var currentPosition = Owner.Transform.Coordinates;
|
var currentPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||||
var nextPosition = Owner.Transform.Coordinates.Offset(new Vector2(10.0f, 0.0f));
|
var nextPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates.Offset(new Vector2(10.0f, 0.0f));
|
||||||
var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f);
|
var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f);
|
||||||
var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f);
|
var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f);
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ namespace Content.Server.AI.Utility.Considerations.Movement
|
|||||||
{
|
{
|
||||||
var self = context.GetState<SelfState>().GetValue();
|
var self = context.GetState<SelfState>().GetValue();
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
if (target == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || target.Transform.GridID != self?.Transform.GridID)
|
if (target == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).GridID != (self != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(self.Uid) : null).GridID)
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anything further than 100 tiles gets clamped
|
// Anything further than 100 tiles gets clamped
|
||||||
return (target.Transform.Coordinates.Position - self.Transform.Coordinates.Position).Length / 100;
|
return (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(self.Uid).Coordinates.Position).Length / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.Server.AI.Utils
|
|||||||
public static IEnumerable<IEntity> GetNearestEntities(EntityCoordinates grid, Type component, float range)
|
public static IEnumerable<IEntity> GetNearestEntities(EntityCoordinates grid, Type component, float range)
|
||||||
{
|
{
|
||||||
var inRange = GetEntitiesInRange(grid, component, range).ToList();
|
var inRange = GetEntitiesInRange(grid, component, range).ToList();
|
||||||
var sortedInRange = inRange.OrderBy(o => (o.Transform.Coordinates.Position - grid.Position).Length);
|
var sortedInRange = inRange.OrderBy(o => (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(o.Uid).Coordinates.Position - grid.Position).Length);
|
||||||
|
|
||||||
return sortedInRange;
|
return sortedInRange;
|
||||||
}
|
}
|
||||||
@@ -28,12 +28,12 @@ namespace Content.Server.AI.Utils
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
foreach (var entity in entityManager.GetAllComponents(component).Select(c => c.Owner))
|
foreach (var entity in entityManager.GetAllComponents(component).Select(c => c.Owner))
|
||||||
{
|
{
|
||||||
if (entity.Transform.Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager))
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entity.Transform.Coordinates.Position - grid.Position).Length <= range)
|
if ((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates.Position - grid.Position).Length <= range)
|
||||||
{
|
{
|
||||||
yield return entity;
|
yield return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Clothing
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.Coordinates, typeof(ClothingComponent), controller.VisionRadius))
|
.GetNearestEntities(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, typeof(ClothingComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.AI.WorldState.States.Combat.Nearby
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius))
|
.GetNearestEntities(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
result.Add(entity);
|
result.Add(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility.GetEntitiesInRange(Owner.Transform.Coordinates, typeof(SharedBodyComponent), controller.VisionRadius))
|
foreach (var entity in Visibility.GetEntitiesInRange(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, typeof(SharedBodyComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (entity == Owner) continue;
|
if (entity == Owner) continue;
|
||||||
result.Add(entity);
|
result.Add(entity);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nearbyPlayers = Filter.Empty()
|
var nearbyPlayers = Filter.Empty()
|
||||||
.AddInRange(Owner.Transform.MapPosition, controller.VisionRadius)
|
.AddInRange(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).MapPosition, controller.VisionRadius)
|
||||||
.Recipients;
|
.Recipients;
|
||||||
|
|
||||||
foreach (var player in nearbyPlayers)
|
foreach (var player in nearbyPlayers)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.Coordinates, typeof(DrinkComponent), controller.VisionRadius))
|
.GetNearestEntities(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, typeof(DrinkComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.Coordinates, typeof(FoodComponent), controller.VisionRadius))
|
.GetNearestEntities(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, typeof(FoodComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Content.Server.AME
|
|||||||
var nodeOwner = node.Owner;
|
var nodeOwner = node.Owner;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(nodeOwner.Uid, out AMEShieldComponent? shield))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(nodeOwner.Uid, out AMEShieldComponent? shield))
|
||||||
{
|
{
|
||||||
var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1)
|
var nodeNeighbors = grid.GetCellsInSquareArea(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(nodeOwner.Uid).Coordinates, 1)
|
||||||
.Select(sgc => IoCManager.Resolve<IEntityManager>().GetEntity(sgc))
|
.Select(sgc => IoCManager.Resolve<IEntityManager>().GetEntity(sgc))
|
||||||
.Where(entity => entity != nodeOwner && IoCManager.Resolve<IEntityManager>().HasComponent<AMEShieldComponent>(entity.Uid));
|
.Where(entity => entity != nodeOwner && IoCManager.Resolve<IEntityManager>().HasComponent<AMEShieldComponent>(entity.Uid));
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Server.Actions.Actions
|
|||||||
{
|
{
|
||||||
// Fall back to a normal interaction with the entity
|
// Fall back to a normal interaction with the entity
|
||||||
var player = actor.PlayerSession;
|
var player = actor.PlayerSession;
|
||||||
var coordinates = args.Target.Transform.Coordinates;
|
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).Coordinates;
|
||||||
var target = args.Target.Uid;
|
var target = args.Target.Uid;
|
||||||
EntitySystem.Get<InteractionSystem>().HandleUseInteraction(player, coordinates, target);
|
EntitySystem.Get<InteractionSystem>().HandleUseInteraction(player, coordinates, target);
|
||||||
return;
|
return;
|
||||||
@@ -74,7 +74,7 @@ namespace Content.Server.Actions.Actions
|
|||||||
var random = IoCManager.Resolve<IRobustRandom>();
|
var random = IoCManager.Resolve<IRobustRandom>();
|
||||||
var system = EntitySystem.Get<MeleeWeaponSystem>();
|
var system = EntitySystem.Get<MeleeWeaponSystem>();
|
||||||
|
|
||||||
var diff = args.Target.Transform.MapPosition.Position - args.Performer.Transform.MapPosition.Position;
|
var diff = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).MapPosition.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Performer.Uid).MapPosition.Position;
|
||||||
var angle = Angle.FromWorldVec(diff);
|
var angle = Angle.FromWorldVec(diff);
|
||||||
|
|
||||||
actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown));
|
actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown));
|
||||||
@@ -114,7 +114,7 @@ namespace Content.Server.Actions.Actions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
|
SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Performer.Uid).Coordinates, AudioHelpers.WithVariation(0.025f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Content.Server.Actions
|
|||||||
targetEntityMsg.Target);
|
targetEntityMsg.Target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CheckRangeAndSetFacing(entity.Transform.Coordinates, player)) return;
|
if (!CheckRangeAndSetFacing(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates, player)) return;
|
||||||
|
|
||||||
attempt.DoTargetEntityAction(player, entity);
|
attempt.DoTargetEntityAction(player, entity);
|
||||||
break;
|
break;
|
||||||
@@ -198,7 +198,7 @@ namespace Content.Server.Actions
|
|||||||
{
|
{
|
||||||
// ensure it's within their clickable range
|
// ensure it's within their clickable range
|
||||||
var targetWorldPos = target.ToMapPos(EntityManager);
|
var targetWorldPos = target.ToMapPos(EntityManager);
|
||||||
var rangeBox = new Box2(player.Transform.WorldPosition, player.Transform.WorldPosition)
|
var rangeBox = new Box2(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).WorldPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).WorldPosition)
|
||||||
.Enlarged(MaxUpdateRange);
|
.Enlarged(MaxUpdateRange);
|
||||||
if (!rangeBox.Contains(targetWorldPos))
|
if (!rangeBox.Contains(targetWorldPos))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.Server.Actions.Spells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Look this is shitty and ideally a test would do it
|
// TODO: Look this is shitty and ideally a test would do it
|
||||||
var spawnedProto = IoCManager.Resolve<IEntityManager>().SpawnEntity(ItemProto, caster.Transform.MapPosition);
|
var spawnedProto = IoCManager.Resolve<IEntityManager>().SpawnEntity(ItemProto, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(caster.Uid).MapPosition);
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(spawnedProto.Uid, out ItemComponent? itemComponent))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(spawnedProto.Uid, out ItemComponent? itemComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace Content.Server.Administration
|
|||||||
verb.Category = VerbCategory.Debug;
|
verb.Category = VerbCategory.Debug;
|
||||||
verb.Act = () =>
|
verb.Act = () =>
|
||||||
{
|
{
|
||||||
var coords = args.Target.Transform.Coordinates;
|
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.Target.Uid).Coordinates;
|
||||||
Timer.Spawn(_gameTiming.TickPeriod, () => _explosions.SpawnExplosion(coords, 0, 1, 2, 1), CancellationToken.None);
|
Timer.Spawn(_gameTiming.TickPeriod, () => _explosions.SpawnExplosion(coords, 0, 1, 2, 1), CancellationToken.None);
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Target.Uid, out SharedBodyComponent? body))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Target.Uid, out SharedBodyComponent? body))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Server.Player;
|
|||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
{
|
{
|
||||||
@@ -41,9 +42,9 @@ namespace Content.Server.Administration.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var canReturn = mind.CurrentEntity != null;
|
var canReturn = mind.CurrentEntity != null;
|
||||||
var ghost = IoCManager.Resolve<IEntityManager>()
|
IEntity? tempQualifier = player.AttachedEntity;
|
||||||
.SpawnEntity("AdminObserver", player.AttachedEntity?.Transform.Coordinates
|
var ghost = IoCManager.Resolve<IEntityManager>().SpawnEntity((string?) "AdminObserver", (EntityCoordinates) ((tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid) : null).Coordinates
|
||||||
?? EntitySystem.Get<GameTicker>().GetObserverSpawnPoint());
|
?? EntitySystem.Get<GameTicker>().GetObserverSpawnPoint()));
|
||||||
|
|
||||||
if (canReturn)
|
if (canReturn)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Administration;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
var lgh = int.Parse(args[4]);
|
var lgh = int.Parse(args[4]);
|
||||||
var fla = int.Parse(args[5]);
|
var fla = int.Parse(args[5]);
|
||||||
|
|
||||||
var mapTransform = player.AttachedEntity.Transform.GetMapTransform();
|
var mapTransform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).GetMapTransform();
|
||||||
var coords = new EntityCoordinates(mapTransform.Owner.Uid, x, y);
|
var coords = new EntityCoordinates(mapTransform.Owner.Uid, x, y);
|
||||||
|
|
||||||
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(coords, dev, hvy, lgh, fla);
|
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(coords, dev, hvy, lgh, fla);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var equipmentEntity = entityManager.SpawnEntity(gearStr, target.Transform.Coordinates);
|
var equipmentEntity = entityManager.SpawnEntity(gearStr, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates);
|
||||||
if (slot == EquipmentSlotDefines.Slots.IDCARD &&
|
if (slot == EquipmentSlotDefines.Slots.IDCARD &&
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<PDAComponent?>(equipmentEntity.Uid, out var pdaComponent) &&
|
IoCManager.Resolve<IEntityManager>().TryGetComponent<PDAComponent?>(equipmentEntity.Uid, out var pdaComponent) &&
|
||||||
pdaComponent.ContainedID != null)
|
pdaComponent.ContainedID != null)
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ namespace Content.Server.Administration.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var currentMap = player.AttachedEntity.Transform.MapID;
|
var currentMap = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).MapID;
|
||||||
var currentGrid = player.AttachedEntity.Transform.GridID;
|
var currentGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).GridID;
|
||||||
|
|
||||||
var found = entMan.EntityQuery<WarpPointComponent>(true)
|
var found = entMan.EntityQuery<WarpPointComponent>(true)
|
||||||
.Where(p => p.Location == location)
|
.Where(p => p.Location == location)
|
||||||
.Select(p => p.Owner.Transform.Coordinates)
|
.Select(p => IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(p.Owner.Uid).Coordinates)
|
||||||
.OrderBy(p => p, Comparer<EntityCoordinates>.Create((a, b) =>
|
.OrderBy(p => p, Comparer<EntityCoordinates>.Create((a, b) =>
|
||||||
{
|
{
|
||||||
// Sort so that warp points on the same grid/map are first.
|
// Sort so that warp points on the same grid/map are first.
|
||||||
@@ -113,7 +113,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
if (found.GetGridId(entMan) != GridId.Invalid)
|
if (found.GetGridId(entMan) != GridId.Invalid)
|
||||||
{
|
{
|
||||||
player.AttachedEntity.Transform.Coordinates = found;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).Coordinates = found;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity.Uid, out IPhysBody? physics))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player.AttachedEntity.Uid, out IPhysBody? physics))
|
||||||
{
|
{
|
||||||
physics.LinearVelocity = Vector2.Zero;
|
physics.LinearVelocity = Vector2.Zero;
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ namespace Content.Server.Arcade.Components
|
|||||||
public void ProcessWin()
|
public void ProcessWin()
|
||||||
{
|
{
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
entityManager.SpawnEntity(_random.Pick(_possibleRewards), Owner.Transform.MapPosition);
|
entityManager.SpawnEntity(_random.Pick(_possibleRewards), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).MapPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gridId = player.AttachedEntity.Transform.GridID;
|
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).GridID;
|
||||||
|
|
||||||
if (gridId == GridId.Invalid)
|
if (gridId == GridId.Invalid)
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gridId = player.AttachedEntity.Transform.GridID;
|
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity.Uid).GridID;
|
||||||
|
|
||||||
if (gridId == GridId.Invalid)
|
if (gridId == GridId.Invalid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
||||||
var pressure = 0f;
|
var pressure = 0f;
|
||||||
var tile = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(Owner.Transform.Coordinates);
|
var tile = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
pressure = tile.Pressure;
|
pressure = tile.Pressure;
|
||||||
@@ -171,7 +171,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = Owner.Transform.Coordinates;
|
var pos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||||
if (!_checkPlayer && _position.HasValue)
|
if (!_checkPlayer && _position.HasValue)
|
||||||
{
|
{
|
||||||
// Check if position is out of range => don't update
|
// Check if position is out of range => don't update
|
||||||
|
|||||||
@@ -279,11 +279,11 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
if (_integrity <= 0)
|
if (_integrity <= 0)
|
||||||
{
|
{
|
||||||
var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true);
|
var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, true);
|
||||||
if(environment != null)
|
if(environment != null)
|
||||||
atmosphereSystem.Merge(environment, Air);
|
atmosphereSystem.Merge(environment, Air);
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.125f));
|
SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, AudioHelpers.WithVariation(0.125f));
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner.Uid);
|
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner.Uid);
|
||||||
return;
|
return;
|
||||||
@@ -297,7 +297,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
{
|
{
|
||||||
if (_integrity <= 0)
|
if (_integrity <= 0)
|
||||||
{
|
{
|
||||||
var environment = atmosphereSystem.GetTileMixture(Owner.Transform.Coordinates, true);
|
var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates, true);
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
// TODO ATMOS stuns?
|
// TODO ATMOS stuns?
|
||||||
|
|
||||||
var transform = physics.Owner.Transform;
|
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physics.Owner.Uid);
|
||||||
var maxForce = MathF.Sqrt(pressureDifference) * 2.25f;
|
var maxForce = MathF.Sqrt(pressureDifference) * 2.25f;
|
||||||
var moveProb = 100f;
|
var moveProb = 100f;
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
if (airtight.FixAirBlockedDirectionInitialize)
|
if (airtight.FixAirBlockedDirectionInitialize)
|
||||||
{
|
{
|
||||||
var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation);
|
var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).WorldRotation);
|
||||||
OnAirtightRotated(uid, airtight, ref rotateEvent);
|
OnAirtightRotated(uid, airtight, ref rotateEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding this component will immediately anchor the entity, because the atmos system
|
// Adding this component will immediately anchor the entity, because the atmos system
|
||||||
// requires airtight entities to be anchored for performance.
|
// requires airtight entities to be anchored for performance.
|
||||||
airtight.Owner.Transform.Anchored = true;
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Anchored = true;
|
||||||
|
|
||||||
UpdatePosition(airtight);
|
UpdatePosition(airtight);
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,8 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
|
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
|
||||||
{
|
{
|
||||||
var gridId = airtight.Owner.Transform.GridID;
|
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID;
|
||||||
var coords = airtight.Owner.Transform.Coordinates;
|
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Coordinates;
|
||||||
|
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var tilePos = grid.TileIndicesFor(coords);
|
var tilePos = grid.TileIndicesFor(coords);
|
||||||
@@ -84,11 +84,11 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
public void UpdatePosition(AirtightComponent airtight)
|
public void UpdatePosition(AirtightComponent airtight)
|
||||||
{
|
{
|
||||||
if (!airtight.Owner.Transform.Anchored || !airtight.Owner.Transform.GridID.IsValid())
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Anchored || !IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var grid = _mapManager.GetGrid(airtight.Owner.Transform.GridID);
|
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID);
|
||||||
airtight.LastPosition = (airtight.Owner.Transform.GridID, grid.TileIndicesFor(airtight.Owner.Transform.Coordinates));
|
airtight.LastPosition = (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Coordinates));
|
||||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,16 +136,16 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
var entity = session.AttachedEntity;
|
var entity = session.AttachedEntity;
|
||||||
|
|
||||||
var worldBounds = Box2.CenteredAround(entity.Transform.WorldPosition,
|
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition,
|
||||||
new Vector2(LocalViewRange, LocalViewRange));
|
new Vector2(LocalViewRange, LocalViewRange));
|
||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(entity.Transform.MapID, worldBounds))
|
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID, worldBounds))
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue;
|
if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue;
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt.Uid, out var gam)) continue;
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt.Uid, out var gam)) continue;
|
||||||
|
|
||||||
var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices;
|
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates).GridIndices;
|
||||||
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
|
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
|
||||||
var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange];
|
var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange];
|
||||||
|
|
||||||
|
|||||||
@@ -1315,7 +1315,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
|
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
|
||||||
{
|
{
|
||||||
var grid = atmosDevice.Owner.Transform.GridID;
|
var grid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(atmosDevice.Owner.Uid).GridID;
|
||||||
|
|
||||||
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
|
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
|
||||||
{
|
{
|
||||||
var tile = GetTileMixture(exposed.Owner.Transform.Coordinates);
|
var tile = GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner.Uid).Coordinates);
|
||||||
if (tile == null) continue;
|
if (tile == null) continue;
|
||||||
var updateEvent = new AtmosExposedUpdateEvent(exposed.Owner.Transform.Coordinates, tile);
|
var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner.Uid).Coordinates, tile);
|
||||||
RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent);
|
RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,17 +197,17 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
// This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data).
|
// This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data).
|
||||||
var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1);
|
var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1);
|
||||||
|
|
||||||
var worldBounds = Box2.CenteredAround(entity.Transform.WorldPosition,
|
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition,
|
||||||
new Vector2(_updateRange, _updateRange));
|
new Vector2(_updateRange, _updateRange));
|
||||||
|
|
||||||
foreach (var grid in _mapManager.FindGridsIntersecting(entity.Transform.MapID, worldBounds))
|
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID, worldBounds))
|
||||||
{
|
{
|
||||||
if (!_overlay.TryGetValue(grid.Index, out var chunks))
|
if (!_overlay.TryGetValue(grid.Index, out var chunks))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices;
|
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates).GridIndices;
|
||||||
|
|
||||||
for (var x = -maxXDiff; x <= maxXDiff; x++)
|
for (var x = -maxXDiff; x <= maxXDiff; x++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vent.Owner.Uid).Coordinates, true);
|
||||||
|
|
||||||
// We're in an air-blocked tile... Do nothing.
|
// We're in an air-blocked tile... Do nothing.
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str,
|
if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str,
|
||||||
@@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
_userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession);
|
_userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession);
|
||||||
DirtyUI(uid, component);
|
DirtyUI(uid, component);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args)
|
||||||
{
|
{
|
||||||
if (!valve.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(valve.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Loc.TryGetString("gas-valve-system-examined", out var str,
|
if (Loc.TryGetString("gas-valve-system-examined", out var str,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|
|
||||||
private void OnExamined(EntityUid uid, GasVolumePumpComponent pump, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, GasVolumePumpComponent pump, ExaminedEvent args)
|
||||||
{
|
{
|
||||||
if (!pump.Owner.Transform.Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Loc.TryGetString("gas-volume-pump-system-examined", out var str,
|
if (Loc.TryGetString("gas-volume-pump-system-examined", out var str,
|
||||||
@@ -83,7 +83,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
// Some of the gas from the mixture leaks when overclocked.
|
// Some of the gas from the mixture leaks when overclocked.
|
||||||
if (pump.Overclocked)
|
if (pump.Overclocked)
|
||||||
{
|
{
|
||||||
var tile = _atmosphereSystem.GetTileMixture(pump.Owner.Transform.Coordinates, true);
|
var tile = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pump.Owner.Uid).Coordinates, true);
|
||||||
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
@@ -100,7 +100,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
_userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession);
|
_userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession);
|
||||||
DirtyUI(uid, component);
|
DirtyUI(uid, component);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
|
|
||||||
private bool CanJoinAtmosphere(AtmosDeviceComponent component)
|
private bool CanJoinAtmosphere(AtmosDeviceComponent component)
|
||||||
{
|
{
|
||||||
return !component.RequireAnchored || component.Owner.Transform.Anchored;
|
return !component.RequireAnchored || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void JoinAtmosphere(AtmosDeviceComponent component)
|
public void JoinAtmosphere(AtmosDeviceComponent component)
|
||||||
@@ -104,7 +104,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.RequireAnchored)
|
if (!component.RequireAnchored)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(component.Owner.Transform.Anchored)
|
if(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored)
|
||||||
JoinAtmosphere(component);
|
JoinAtmosphere(component);
|
||||||
else
|
else
|
||||||
LeaveAtmosphere(component);
|
LeaveAtmosphere(component);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment)
|
if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Coordinates) is not {} environment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var node in nodes.Nodes.Values)
|
foreach (var node in nodes.Nodes.Values)
|
||||||
@@ -52,7 +52,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment)
|
if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Coordinates, true) is not {} environment)
|
||||||
environment = GasMixture.SpaceGas;
|
environment = GasMixture.SpaceGas;
|
||||||
|
|
||||||
var lost = 0f;
|
var lost = 0f;
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
|
|
||||||
private bool CheckMinerOperation(GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment)
|
private bool CheckMinerOperation(GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment)
|
||||||
{
|
{
|
||||||
environment = _atmosphereSystem.GetTileMixture(miner.Owner.Transform.Coordinates, true);
|
environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(miner.Owner.Uid).Coordinates, true);
|
||||||
|
|
||||||
// Space.
|
// Space.
|
||||||
if (_atmosphereSystem.IsTileSpace(miner.Owner.Transform.Coordinates))
|
if (_atmosphereSystem.IsTileSpace(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(miner.Owner.Uid).Coordinates))
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
_userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession);
|
_userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession);
|
||||||
DirtyUI(uid, component);
|
DirtyUI(uid, component);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User.Uid, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Owner.Transform.Anchored)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner.Uid).Anchored)
|
||||||
{
|
{
|
||||||
_userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession);
|
_userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession);
|
||||||
DirtyUI(uid, component);
|
DirtyUI(uid, component);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var environment = _atmosphereSystem.GetTileMixture(canister.Owner.Transform.Coordinates, true);
|
var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(canister.Owner.Uid).Coordinates, true);
|
||||||
_atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
|
_atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var environment = _atmosphereSystem.GetTileMixture(injector.Owner.Transform.Coordinates, true);
|
var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(injector.Owner.Uid).Coordinates, true);
|
||||||
|
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user