Inline Transform
This commit is contained in:
@@ -46,13 +46,13 @@ namespace Content.Client.AI
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_eyeManager.GetWorldViewport().Contains(entity.Transform.WorldPosition))
|
||||
if (!_eyeManager.GetWorldViewport().Contains(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition))
|
||||
{
|
||||
panel.Visible = false;
|
||||
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);
|
||||
panel.Visible = true;
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace Content.Client.AI
|
||||
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ namespace Content.Client.AI
|
||||
screenTile.X + 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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ namespace Content.Client.AI
|
||||
screenTile.X + 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.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.Administration
|
||||
@@ -41,7 +42,7 @@ namespace Content.Client.Administration
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
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);
|
||||
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)" : "")}");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
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)" : "")}");
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||
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)" : "")}");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Client.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
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);
|
||||
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)" : "")}");
|
||||
}
|
||||
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace Content.Client.Audio
|
||||
return;
|
||||
}
|
||||
|
||||
var coordinates = player.Transform.Coordinates;
|
||||
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).Coordinates;
|
||||
|
||||
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)
|
||||
{
|
||||
continue;
|
||||
@@ -140,7 +140,7 @@ namespace Content.Client.Audio
|
||||
_playingSounds.ContainsKey(ambientComp) ||
|
||||
!ambientComp.Enabled ||
|
||||
// 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)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Client.Body.UI
|
||||
|
||||
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);
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace Content.Client.Chat.Managers
|
||||
private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType)
|
||||
{
|
||||
// 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
return;
|
||||
@@ -123,7 +123,7 @@ namespace Content.Client.Chat.UI
|
||||
return;
|
||||
}
|
||||
|
||||
var worldPos = _senderEntity.Transform.WorldPosition;
|
||||
var worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_senderEntity.Uid).WorldPosition;
|
||||
var scale = _eyeManager.MainViewport.GetRenderScale();
|
||||
var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale);
|
||||
var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Client.Clickable
|
||||
return false;
|
||||
}
|
||||
|
||||
var transform = Owner.Transform;
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid);
|
||||
var localPos = transform.InvWorldMatrix.Transform(worldPos);
|
||||
var spriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix());
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Content.Client.Construction
|
||||
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost.Uid);
|
||||
comp.Prototype = prototype;
|
||||
comp.GhostId = _nextId++;
|
||||
ghost.Transform.LocalRotation = dir.ToAngle();
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Uid).LocalRotation = dir.ToAngle();
|
||||
_ghosts.Add(comp.GhostId, comp);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost.Uid);
|
||||
sprite.Color = new Color(48, 255, 48, 128);
|
||||
@@ -191,7 +191,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
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;
|
||||
@@ -206,7 +206,7 @@ namespace Content.Client.Construction
|
||||
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);
|
||||
RaiseNetworkEvent(msg);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
|
||||
|
||||
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;
|
||||
if (session != null)
|
||||
@@ -190,7 +190,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add menu elements for a list of grouped entities;
|
||||
/// Add menu elements for a list of grouped entities;
|
||||
/// </summary>
|
||||
/// <param name="entityGroups"> A list of entity groups. Entities are grouped together based on prototype.</param>
|
||||
private void AddToUI(List<List<IEntity>> entityGroups)
|
||||
@@ -220,7 +220,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
AddElement(RootMenu, element);
|
||||
Elements.TryAdd(group[0], element);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,23 +59,23 @@ namespace Content.Client.DoAfter
|
||||
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
|
||||
{
|
||||
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 ||
|
||||
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))
|
||||
{
|
||||
comp.Disable();
|
||||
continue;
|
||||
}
|
||||
|
||||
var range = (compPos - _attachedEntity.Transform.WorldPosition).Length +
|
||||
var range = (compPos - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).WorldPosition).Length +
|
||||
0.01f;
|
||||
|
||||
if (comp.Owner != _attachedEntity &&
|
||||
!ExamineSystemShared.InRangeUnOccluded(
|
||||
_attachedEntity.Transform.MapPosition,
|
||||
comp.Owner.Transform.MapPosition, range,
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapPosition,
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).MapPosition, range,
|
||||
entity => entity == comp.Owner || entity == _attachedEntity))
|
||||
{
|
||||
comp.Disable();
|
||||
@@ -84,7 +84,7 @@ namespace Content.Client.DoAfter
|
||||
|
||||
comp.Enable();
|
||||
|
||||
var userGrid = comp.Owner.Transform.Coordinates;
|
||||
var userGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).Coordinates;
|
||||
|
||||
// Check cancellations / finishes
|
||||
foreach (var (id, doAfter) in doAfters)
|
||||
@@ -117,7 +117,7 @@ namespace Content.Client.DoAfter
|
||||
if (doAfter.BreakOnTargetMove)
|
||||
{
|
||||
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))
|
||||
{
|
||||
comp.Cancel(id, currentTime);
|
||||
|
||||
@@ -166,8 +166,8 @@ namespace Content.Client.DoAfter.UI
|
||||
return;
|
||||
}
|
||||
|
||||
if (_eyeManager.CurrentMap != AttachedEntity.Transform.MapID ||
|
||||
!AttachedEntity.Transform.Coordinates.IsValid(_entityManager))
|
||||
if (_eyeManager.CurrentMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).MapID ||
|
||||
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).Coordinates.IsValid(_entityManager))
|
||||
{
|
||||
Visible = false;
|
||||
return;
|
||||
@@ -217,7 +217,7 @@ namespace Content.Client.DoAfter.UI
|
||||
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);
|
||||
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;
|
||||
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();
|
||||
@@ -233,7 +233,7 @@ namespace Content.Client.DragDrop
|
||||
if (_dragShadow == null)
|
||||
return false;
|
||||
|
||||
_dragShadow.Transform.WorldPosition = mousePos.Position;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragShadow.Uid).WorldPosition = mousePos.Position;
|
||||
|
||||
_targetRecheckTime += frameTime;
|
||||
if (_targetRecheckTime > TargetRecheckInterval)
|
||||
@@ -295,7 +295,7 @@ namespace Content.Client.DragDrop
|
||||
|
||||
// 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
|
||||
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.
|
||||
// We don't use args.EntityUid here because drag interactions generally should
|
||||
// work even if there's something "on top" of the drop target
|
||||
@@ -379,7 +379,7 @@ namespace Content.Client.DragDrop
|
||||
pvsEntity == _dragDropHelper.Dragged) continue;
|
||||
|
||||
// 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);
|
||||
if (valid == null) continue;
|
||||
|
||||
@@ -83,13 +83,13 @@ namespace Content.Client.HealthOverlay
|
||||
{
|
||||
var entity = mobState.Owner;
|
||||
|
||||
if (_attachedEntity.Transform.MapID != entity.Transform.MapID ||
|
||||
!viewBox.Contains(entity.Transform.WorldPosition))
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID ||
|
||||
!viewBox.Contains(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition))
|
||||
{
|
||||
if (_guis.TryGetValue(entity.Uid, out var oldGui))
|
||||
{
|
||||
_guis.Remove(entity.Uid);
|
||||
oldGui.Dispose();
|
||||
oldGui.Dispose();
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Content.Client.HealthOverlay.UI
|
||||
MoreFrameUpdate(args);
|
||||
|
||||
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;
|
||||
return;
|
||||
@@ -147,7 +147,7 @@ namespace Content.Client.HealthOverlay.UI
|
||||
|
||||
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);
|
||||
LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Content.Client.IconSmoothing
|
||||
{
|
||||
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
|
||||
// the hook here would cause a dirty event to fire needlessly
|
||||
@@ -95,9 +95,9 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
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
|
||||
{
|
||||
@@ -109,9 +109,9 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
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;
|
||||
}
|
||||
CalculateNewSprite(grid);
|
||||
@@ -136,14 +136,14 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
private void CalculateNewSpriteCardinal(IMapGrid grid)
|
||||
{
|
||||
if (!Owner.Transform.Anchored || Sprite == null)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored || Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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)))
|
||||
dirs |= CardinalConnectDirs.North;
|
||||
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)
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored)
|
||||
{
|
||||
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 ne = MatchingEntity(grid.GetInDir(position, Direction.NorthEast));
|
||||
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).
|
||||
switch (Owner.Transform.LocalRotation.GetCardinalDir())
|
||||
switch (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).LocalRotation.GetCardinalDir())
|
||||
{
|
||||
case Direction.North:
|
||||
return (cornerSW, cornerSE, cornerNE, cornerNW);
|
||||
@@ -258,7 +258,7 @@ namespace Content.Client.IconSmoothing
|
||||
{
|
||||
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));
|
||||
}
|
||||
@@ -266,7 +266,7 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
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));
|
||||
UpdateLastPosition();
|
||||
|
||||
@@ -52,11 +52,11 @@ namespace Content.Client.IconSmoothing
|
||||
// This is simpler to implement. If you want to optimize it be my guest.
|
||||
var senderEnt = ev.Sender;
|
||||
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)
|
||||
&& iconSmooth.Running)
|
||||
{
|
||||
var coords = senderEnt.Transform.Coordinates;
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(senderEnt.Uid).Coordinates;
|
||||
|
||||
_dirtyEntities.Enqueue(senderEnt.Uid);
|
||||
AddValidEntities(grid1.GetInDir(coords, Direction.North));
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Client.Interactable
|
||||
bool ignoreInsideBlocker = 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,
|
||||
popup);
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -80,9 +81,9 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
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 gridTile = grid.TileIndicesFor(entity.Transform.Coordinates);
|
||||
var gridTile = grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append($"entity: {entity}\n");
|
||||
@@ -119,10 +120,10 @@ namespace Content.Client.NodeContainer
|
||||
if (!_system.Entities.TryGetValue(entity.Uid, out var nodeData))
|
||||
return;
|
||||
|
||||
var gridId = entity.Transform.GridID;
|
||||
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).GridID;
|
||||
var grid = _mapManager.GetGrid(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...
|
||||
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Content.Client.Popups
|
||||
|
||||
var position = Entity == null
|
||||
? 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)));
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Content.Client.Singularity
|
||||
|
||||
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
|
||||
{
|
||||
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.Falloff = distortion.Falloff;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace Content.Client.Singularity
|
||||
|
||||
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
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Content.Client.Spawners
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Content.Client.StationEvents
|
||||
(
|
||||
_baseShader.Duplicate(),
|
||||
new RadiationShaderInstance(
|
||||
pulseEntity.Transform.MapPosition.Position,
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pulseEntity.Uid).MapPosition.Position,
|
||||
pulse.Range,
|
||||
pulse.StartTime,
|
||||
pulse.EndTime
|
||||
@@ -111,7 +111,7 @@ namespace Content.Client.StationEvents
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<RadiationPulseComponent?>(pulseEntity.Uid, out var pulse))
|
||||
{
|
||||
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;
|
||||
} else {
|
||||
_pulses[activePulseUid].shd.Dispose();
|
||||
@@ -123,7 +123,7 @@ namespace Content.Client.StationEvents
|
||||
|
||||
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)
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Content.Client.Storage
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Content.Client.Verbs
|
||||
if (!_examineSystem.CanExamine(player, targetPos, predicate))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Get entities
|
||||
var entities = _entityLookup.GetEntitiesInRange(targetPos.MapId, targetPos.Position, EntityMenuLookupSize)
|
||||
.ToList();
|
||||
@@ -155,12 +155,12 @@ namespace Content.Client.Verbs
|
||||
// Remove any entities that do not have LOS
|
||||
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())
|
||||
{
|
||||
if (!ExamineSystemShared.InRangeUnOccluded(
|
||||
playerPos,
|
||||
entity.Transform.MapPosition,
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapPosition,
|
||||
ExamineSystemShared.ExamineRange,
|
||||
null))
|
||||
{
|
||||
@@ -186,7 +186,7 @@ namespace Content.Client.Verbs
|
||||
{
|
||||
RaiseNetworkEvent(new RequestServerVerbsEvent(target.Uid, verbTypes));
|
||||
}
|
||||
|
||||
|
||||
return GetLocalVerbs(target, user, verbTypes);
|
||||
}
|
||||
|
||||
|
||||
@@ -223,8 +223,8 @@ namespace Content.Client.Viewport
|
||||
}
|
||||
*/
|
||||
|
||||
var transX = x.clicked.Transform;
|
||||
var transY = y.clicked.Transform;
|
||||
var transX = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(x.clicked.Uid);
|
||||
var transY = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(y.clicked.Uid);
|
||||
val = transX.Coordinates.Y.CompareTo(transY.Coordinates.Y);
|
||||
if (val != 0)
|
||||
{
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Content.Client.Wall.Components
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
_overlayEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
|
||||
_overlayEntity.Transform.AttachParent(Owner);
|
||||
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
||||
_overlayEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity("LowWallOverlay", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_overlayEntity.Uid).AttachParent(Owner);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_overlayEntity.Uid).LocalPosition = Vector2.Zero;
|
||||
|
||||
_overlaySprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(_overlayEntity.Uid);
|
||||
|
||||
@@ -74,13 +74,13 @@ namespace Content.Client.Wall.Components
|
||||
{
|
||||
base.CalculateNewSprite();
|
||||
|
||||
if (Sprite == null || !Owner.Transform.Anchored || _overlaySprite == null)
|
||||
if (Sprite == null || !IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Anchored || _overlaySprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var grid = _mapManager.GetGrid(Owner.Transform.GridID);
|
||||
var coords = Owner.Transform.Coordinates;
|
||||
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).Coordinates;
|
||||
|
||||
var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North));
|
||||
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));
|
||||
_baseAngle = baseAngle;
|
||||
if(followAttacker)
|
||||
Owner.Transform.AttachParent(attacker);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).AttachParent(attacker);
|
||||
}
|
||||
|
||||
internal void Update(float frameTime)
|
||||
@@ -55,12 +55,12 @@ namespace Content.Client.Weapons.Melee.Components
|
||||
{
|
||||
case WeaponArcType.Slash:
|
||||
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));
|
||||
break;
|
||||
|
||||
case WeaponArcType.Poke:
|
||||
Owner.Transform.WorldRotation = _baseAngle;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Uid).WorldRotation = _baseAngle;
|
||||
|
||||
if (_sprite != null)
|
||||
{
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace Content.Client.Weapons.Melee
|
||||
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
||||
lunge.SetData(msg.Angle);
|
||||
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
||||
entity.Transform.LocalRotation = msg.Angle;
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attacker.Uid).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).LocalRotation = msg.Angle;
|
||||
|
||||
var weaponArcAnimation = IoCManager.Resolve<IEntityManager>().GetComponent<MeleeWeaponArcAnimationComponent>(entity.Uid);
|
||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
||||
@@ -73,7 +73,7 @@ namespace Content.Client.Weapons.Melee
|
||||
{
|
||||
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
||||
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),
|
||||
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
||||
Velocity = msg.Angle.ToWorldVec(),
|
||||
|
||||
Reference in New Issue
Block a user