Resolve 'TransformComponent.MapPosition' is obsolete in content (#27939)
* Resolve `'TransformComponent.MapPosition' is obsolete: 'Use TransformSystem.GetMapCoordinates'` in content * build?
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Explosion;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
@@ -22,7 +23,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private readonly SpawnExplosionEui _eui;
|
||||
private List<MapId> _mapData = new();
|
||||
@@ -37,6 +38,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
_transform = _entMan.System<TransformSystem>();
|
||||
_eui = eui;
|
||||
|
||||
ExplosionOption.OnItemSelected += ExplosionSelected;
|
||||
@@ -104,7 +106,7 @@ public sealed partial class SpawnExplosionWindow : DefaultWindow
|
||||
|
||||
_pausePreview = true;
|
||||
MapOptions.Select(_mapData.IndexOf(transform.MapID));
|
||||
(MapX.Value, MapY.Value) = transform.MapPosition.Position;
|
||||
(MapX.Value, MapY.Value) = _transform.GetMapCoordinates(_playerManager.LocalEntity!.Value, xform: transform).Position;
|
||||
_pausePreview = false;
|
||||
|
||||
UpdatePreview();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Client.GPS.Components;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.Stylesheets;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -13,11 +14,13 @@ public sealed class HandheldGpsStatusControl : Control
|
||||
private readonly RichTextLabel _label;
|
||||
private float _updateDif;
|
||||
private readonly IEntityManager _entMan;
|
||||
private readonly SharedTransformSystem _transform;
|
||||
|
||||
public HandheldGpsStatusControl(Entity<HandheldGPSComponent> parent)
|
||||
{
|
||||
_parent = parent;
|
||||
_entMan = IoCManager.Resolve<IEntityManager>();
|
||||
_transform = _entMan.System<TransformSystem>();
|
||||
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
|
||||
AddChild(_label);
|
||||
UpdateGpsDetails();
|
||||
@@ -41,7 +44,7 @@ public sealed class HandheldGpsStatusControl : Control
|
||||
var posText = "Error";
|
||||
if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
|
||||
{
|
||||
var pos = transComp.MapPosition;
|
||||
var pos = _transform.GetMapCoordinates(_parent.Owner, xform: transComp);
|
||||
var x = (int) pos.X;
|
||||
var y = (int) pos.Y;
|
||||
posText = $"({x}, {y})";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.Replays.Loading;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -37,7 +38,7 @@ public sealed class MouseRotatorSystem : SharedMouseRotatorSystem
|
||||
if (mapPos.MapId == MapId.Nullspace)
|
||||
return;
|
||||
|
||||
var angle = (mapPos.Position - xform.MapPosition.Position).ToWorldAngle();
|
||||
var angle = (mapPos.Position - _transform.GetMapCoordinates(player.Value, xform: xform).Position).ToWorldAngle();
|
||||
|
||||
var curRot = _transform.GetWorldRotation(xform);
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Radiation.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Graphics;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -14,6 +16,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
private TransformSystem? _transform;
|
||||
|
||||
private const float MaxDist = 15.0f;
|
||||
|
||||
@@ -72,6 +75,8 @@ namespace Content.Client.Radiation.Overlays
|
||||
//Queries all pulses on the map and either adds or removes them from the list of rendered pulses based on whether they should be drawn (in range? on the same z-level/map? pulse entity still exists?)
|
||||
private void RadiationQuery(IEye? currentEye)
|
||||
{
|
||||
_transform ??= _entityManager.System<TransformSystem>();
|
||||
|
||||
if (currentEye == null)
|
||||
{
|
||||
_pulses.Clear();
|
||||
@@ -91,7 +96,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
(
|
||||
_baseShader.Duplicate(),
|
||||
new RadiationShaderInstance(
|
||||
_entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition,
|
||||
_transform.GetMapCoordinates(pulseEntity),
|
||||
pulse.VisualRange,
|
||||
pulse.StartTime,
|
||||
pulse.VisualDuration
|
||||
@@ -109,7 +114,7 @@ namespace Content.Client.Radiation.Overlays
|
||||
_entityManager.TryGetComponent(pulseEntity, out RadiationPulseComponent? pulse))
|
||||
{
|
||||
var shaderInstance = _pulses[pulseEntity];
|
||||
shaderInstance.instance.CurrentMapCoords = _entityManager.GetComponent<TransformComponent>(pulseEntity).MapPosition;
|
||||
shaderInstance.instance.CurrentMapCoords = _transform.GetMapCoordinates(pulseEntity);
|
||||
shaderInstance.instance.Range = pulse.VisualRange;
|
||||
} else {
|
||||
_pulses[pulseEntity].shd.Dispose();
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.Sprite;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Client.Sprite;
|
||||
|
||||
@@ -15,6 +16,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
||||
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private readonly HashSet<FadingSpriteComponent> _comps = new();
|
||||
|
||||
@@ -48,7 +50,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
||||
spriteQuery.TryGetComponent(player, out var playerSprite))
|
||||
{
|
||||
var fadeQuery = GetEntityQuery<SpriteFadeComponent>();
|
||||
var mapPos = playerXform.MapPosition;
|
||||
var mapPos = _transform.GetMapCoordinates(_playerManager.LocalEntity!.Value, xform: playerXform);
|
||||
|
||||
// Also want to handle large entities even if they may not be clickable.
|
||||
foreach (var ent in state.GetClickableEntities(mapPos))
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace Content.Client.Tabletop
|
||||
// Set the dragging player on the component to noone
|
||||
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
|
||||
{
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value)));
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
|
||||
}
|
||||
|
||||
@@ -277,7 +277,8 @@ namespace Content.Client.Tabletop
|
||||
if (coordinates == MapCoordinates.Nullspace) return MapCoordinates.Nullspace;
|
||||
|
||||
var eye = viewport.Eye;
|
||||
if (eye == null) return MapCoordinates.Nullspace;
|
||||
if (eye == null)
|
||||
return MapCoordinates.Nullspace;
|
||||
|
||||
var size = (Vector2) viewport.ViewportSize / EyeManager.PixelsPerMeter; // Convert to tiles instead of pixels
|
||||
var eyePosition = eye.Position.Position;
|
||||
|
||||
@@ -60,6 +60,7 @@ public sealed class ChatUIController : UIController
|
||||
[UISystemDependency] private readonly GhostSystem? _ghost = default;
|
||||
[UISystemDependency] private readonly TypingIndicatorSystem? _typingIndicator = default;
|
||||
[UISystemDependency] private readonly ChatSystem? _chatSys = default;
|
||||
[UISystemDependency] private readonly TransformSystem? _transform = default;
|
||||
|
||||
[ValidatePrototypeId<ColorPalettePrototype>]
|
||||
private const string ChatNamePalette = "ChatNames";
|
||||
@@ -625,7 +626,7 @@ public sealed class ChatUIController : UIController
|
||||
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
|
||||
=> uid == data.compOwner || uid == data.attachedEntity;
|
||||
var playerPos = player != null
|
||||
? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
|
||||
? _transform?.GetMapCoordinates(player.Value) ?? MapCoordinates.Nullspace
|
||||
: MapCoordinates.Nullspace;
|
||||
|
||||
var occluded = player != null && _examine.IsOccluded(player.Value);
|
||||
@@ -644,7 +645,7 @@ public sealed class ChatUIController : UIController
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
|
||||
var otherPos = _transform?.GetMapCoordinates(ent) ?? MapCoordinates.Nullspace;
|
||||
|
||||
if (occluded && !_examine.InRangeUnOccluded(
|
||||
playerPos,
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Content.Client.Verbs
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ExamineSystem _examine = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
@@ -141,7 +142,7 @@ namespace Content.Client.Verbs
|
||||
if ((visibility & MenuVisibility.NoFov) == 0)
|
||||
{
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var playerPos = xformQuery.GetComponent(player.Value).MapPosition;
|
||||
var playerPos = _transform.GetMapCoordinates(player.Value, xform: xformQuery.GetComponent(player.Value));
|
||||
|
||||
for (var i = entities.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -149,7 +150,7 @@ namespace Content.Client.Verbs
|
||||
|
||||
if (!_examine.InRangeUnOccluded(
|
||||
playerPos,
|
||||
xformQuery.GetComponent(entity).MapPosition,
|
||||
_transform.GetMapCoordinates(entity, xform: xformQuery.GetComponent(entity)),
|
||||
ExamineSystemShared.ExamineRange,
|
||||
null))
|
||||
{
|
||||
|
||||
@@ -20,10 +20,11 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
private readonly IPlayerManager _playerManager;
|
||||
private readonly MeleeWeaponSystem _melee;
|
||||
private readonly SharedCombatModeSystem _combatMode;
|
||||
private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
|
||||
|
||||
public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInputManager inputManager, IPlayerManager playerManager, MeleeWeaponSystem melee, SharedCombatModeSystem combatMode)
|
||||
public MeleeArcOverlay(IEntityManager entManager, IEyeManager eyeManager, IInputManager inputManager, IPlayerManager playerManager, MeleeWeaponSystem melee, SharedCombatModeSystem combatMode, SharedTransformSystem transform)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_eyeManager = eyeManager;
|
||||
@@ -31,6 +32,7 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
_playerManager = playerManager;
|
||||
_melee = melee;
|
||||
_combatMode = combatMode;
|
||||
_transform = transform;
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -52,7 +54,7 @@ public sealed class MeleeArcOverlay : Overlay
|
||||
if (mapPos.MapId != args.MapId)
|
||||
return;
|
||||
|
||||
var playerPos = xform.MapPosition;
|
||||
var playerPos = _transform.GetMapCoordinates(player.Value, xform: xform);
|
||||
|
||||
if (mapPos.MapId != playerPos.MapId)
|
||||
return;
|
||||
|
||||
@@ -35,6 +35,7 @@ public sealed class MeleeSpreadCommand : IConsoleCommand
|
||||
collection.Resolve<IInputManager>(),
|
||||
collection.Resolve<IPlayerManager>(),
|
||||
sysManager.GetEntitySystem<MeleeWeaponSystem>(),
|
||||
sysManager.GetEntitySystem<SharedCombatModeSystem>()));
|
||||
sysManager.GetEntitySystem<SharedCombatModeSystem>(),
|
||||
sysManager.GetEntitySystem<SharedTransformSystem>()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
// Light attack
|
||||
if (useDown == BoundKeyState.Down)
|
||||
{
|
||||
var attackerPos = Transform(entity).MapPosition;
|
||||
var attackerPos = TransformSystem.GetMapCoordinates(entity);
|
||||
|
||||
if (mousePos.MapId != attackerPos.MapId ||
|
||||
(attackerPos.Position - mousePos.Position).Length() > weapon.Range)
|
||||
|
||||
@@ -18,8 +18,9 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
private readonly IInputManager _input;
|
||||
private readonly IPlayerManager _player;
|
||||
private readonly GunSystem _guns;
|
||||
private readonly SharedTransformSystem _transform;
|
||||
|
||||
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system)
|
||||
public GunSpreadOverlay(IEntityManager entManager, IEyeManager eyeManager, IGameTiming timing, IInputManager input, IPlayerManager player, GunSystem system, SharedTransformSystem transform)
|
||||
{
|
||||
_entManager = entManager;
|
||||
_eye = eyeManager;
|
||||
@@ -27,6 +28,7 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
_timing = timing;
|
||||
_player = player;
|
||||
_guns = system;
|
||||
_transform = transform;
|
||||
}
|
||||
|
||||
protected override void Draw(in OverlayDrawArgs args)
|
||||
@@ -41,7 +43,7 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
return;
|
||||
}
|
||||
|
||||
var mapPos = xform.MapPosition;
|
||||
var mapPos = _transform.GetMapCoordinates(player.Value, xform: xform);
|
||||
|
||||
if (mapPos.MapId == MapId.Nullspace)
|
||||
return;
|
||||
|
||||
@@ -60,7 +60,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
Timing,
|
||||
_inputManager,
|
||||
_player,
|
||||
this));
|
||||
this,
|
||||
TransformSystem));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
// Sloth: Okay I'm sorry but I hate having to rewrite tests for every refactor
|
||||
// If you see this yell at me in discord so I can continue to pretend this didn't happen.
|
||||
// REMINDER THAT I STILL HAVE TO FIX THIS TEST EVERY OTHER PHYSICS PR
|
||||
// Assert.That(AirlockPhysicsDummy.Transform.MapPosition.X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
|
||||
// _transform.GetMapCoordinates(UID HERE, xform: Assert.That(AirlockPhysicsDummy.Transform).X, Is.GreaterThan(AirlockPhysicsDummyStartingX));
|
||||
|
||||
// Blocked by the airlock
|
||||
await server.WaitAssertion(() =>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -24,6 +25,7 @@ public sealed class HandTests
|
||||
var playerMan = server.ResolveDependency<IPlayerManager>();
|
||||
var mapMan = server.ResolveDependency<IMapManager>();
|
||||
var sys = entMan.System<SharedHandsSystem>();
|
||||
var tSys = entMan.System<TransformSystem>();
|
||||
|
||||
var data = await pair.CreateTestMap();
|
||||
await pair.RunTicksSync(5);
|
||||
@@ -35,7 +37,7 @@ public sealed class HandTests
|
||||
{
|
||||
player = playerMan.Sessions.First().AttachedEntity!.Value;
|
||||
var xform = entMan.GetComponent<TransformComponent>(player);
|
||||
item = entMan.SpawnEntity("Crowbar", xform.MapPosition);
|
||||
item = entMan.SpawnEntity("Crowbar", tSys.GetMapCoordinates(player, xform: xform));
|
||||
hands = entMan.GetComponent<HandsComponent>(player);
|
||||
sys.TryPickup(player, item, hands.ActiveHand!);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -32,6 +33,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
var sEntities = server.ResolveDependency<IEntityManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var conSystem = sEntities.EntitySysManager.GetEntitySystem<SharedContainerSystem>();
|
||||
var tSystem = sEntities.EntitySysManager.GetEntitySystem<TransformSystem>();
|
||||
|
||||
EntityUid origin = default;
|
||||
EntityUid other = default;
|
||||
@@ -45,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
origin = sEntities.SpawnEntity(HumanId, coordinates);
|
||||
other = sEntities.SpawnEntity(HumanId, coordinates);
|
||||
conSystem.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||
mapCoordinates = sEntities.GetComponent<TransformComponent>(other).MapPosition;
|
||||
mapCoordinates = tSystem.GetMapCoordinates(other);
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
@@ -105,7 +106,7 @@ public sealed class ExplosionCommand : IConsoleCommand
|
||||
if (args.Length > 4)
|
||||
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
||||
else
|
||||
coords = xform.MapPosition;
|
||||
coords = entMan.System<TransformSystem>().GetMapCoordinates(shell.Player.AttachedEntity.Value, xform: xform);
|
||||
}
|
||||
|
||||
ExplosionPrototype? type;
|
||||
|
||||
@@ -102,7 +102,7 @@ public sealed partial class AdminVerbSystem
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
var coords = Transform(args.Target).MapPosition;
|
||||
var coords = _transformSystem.GetMapCoordinates(args.Target);
|
||||
Timer.Spawn(_gameTiming.TickPeriod,
|
||||
() => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
|
||||
4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high.
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
||||
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
||||
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates(uid, xform), range))
|
||||
{
|
||||
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared.Anomaly.Components;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using System.Linq;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
/// <summary>
|
||||
@@ -16,6 +17,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
private EntityQuery<InjectableSolutionComponent> _injectableQuery;
|
||||
|
||||
@@ -45,7 +47,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
//We get all the entity in the radius into which the reagent will be injected.
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var xform = xformQuery.GetComponent(entity);
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_transform.GetMapCoordinates(entity, xform: xform), injectRadius)
|
||||
.Select(x => x.Owner).ToList();
|
||||
|
||||
//for each matching entity found
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Beam.Components;
|
||||
using Content.Shared.Beam;
|
||||
using Content.Shared.Beam.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
@@ -16,6 +17,7 @@ namespace Content.Server.Beam;
|
||||
public sealed class BeamSystem : SharedBeamSystem
|
||||
{
|
||||
[Dependency] private readonly FixtureSystem _fixture = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
@@ -144,8 +146,8 @@ public sealed class BeamSystem : SharedBeamSystem
|
||||
if (Deleted(user) || Deleted(target))
|
||||
return;
|
||||
|
||||
var userMapPos = Transform(user).MapPosition;
|
||||
var targetMapPos = Transform(target).MapPosition;
|
||||
var userMapPos = _transform.GetMapCoordinates(user);
|
||||
var targetMapPos = _transform.GetMapCoordinates(target);
|
||||
|
||||
//The distance between the target and the user.
|
||||
var calculatedDistance = targetMapPos.Position - userMapPos.Position;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
@@ -58,15 +59,18 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
var splitSolution = args.Source.SplitSolution(args.Source.Volume);
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var mapSys = args.EntityManager.System<MapSystem>();
|
||||
var sys = args.EntityManager.System<TransformSystem>();
|
||||
var mapCoords = sys.GetMapCoordinates(args.SolutionEntity, xform: transform);
|
||||
|
||||
if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
||||
if (!mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) ||
|
||||
!mapSys.TryGetTileRef(gridUid, grid, transform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(transform.MapPosition);
|
||||
var coords = mapSys.MapToGrid(gridUid, mapCoords);
|
||||
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
|
||||
|
||||
var smoke = args.EntityManager.System<SmokeSystem>();
|
||||
|
||||
@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
|
||||
|
||||
for (var i = 0; i < quantity; i++)
|
||||
{
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition);
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates(args.SolutionEntity, xform: transform));
|
||||
transformSystem.AttachToGridOrMap(uid);
|
||||
|
||||
// TODO figure out how to properly spawn inside of containers
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Emp;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReactionEffects;
|
||||
@@ -37,11 +38,12 @@ public sealed partial class EmpReactionEffect : ReagentEffect
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
var tSys = args.EntityManager.System<TransformSystem>();
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
|
||||
|
||||
args.EntityManager.System<EmpSystem>().EmpPulse(
|
||||
transform.MapPosition,
|
||||
args.EntityManager.System<EmpSystem>()
|
||||
.EmpPulse(tSys.GetMapCoordinates(args.SolutionEntity, xform: transform),
|
||||
range,
|
||||
EnergyConsumption,
|
||||
DisableDuration);
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
|
||||
}
|
||||
// end of genetic damage checks
|
||||
|
||||
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
|
||||
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
|
||||
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
||||
|
||||
var ev = new CloningEvent(bodyToClone, mob);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
}
|
||||
|
||||
var pos = Transform(user).MapPosition;
|
||||
var pos = _transformSystem.GetMapCoordinates(user);
|
||||
|
||||
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Forensics;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
@@ -30,7 +31,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
|
||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
|
||||
var tSys = system.EntityManager.System<TransformSystem>();
|
||||
var position = tSys.GetMapCoordinates(owner);
|
||||
|
||||
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
|
||||
|
||||
@@ -48,7 +50,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
? minMax.Min
|
||||
: system.Random.Next(minMax.Min, minMax.Max + 1);
|
||||
|
||||
if (count == 0) continue;
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Content.Server.Disposal.Tube
|
||||
[Dependency] private readonly DisposableSystem _disposableSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -422,7 +423,7 @@ namespace Content.Server.Disposal.Tube
|
||||
return false;
|
||||
|
||||
var xform = Transform(uid);
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _transform.GetMapCoordinates(uid, xform: xform));
|
||||
var holderComponent = Comp<DisposalHolderComponent>(holder);
|
||||
|
||||
foreach (var entity in from.Container.ContainedEntities.ToArray())
|
||||
|
||||
@@ -165,7 +165,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
||||
var carpUid = Spawn(component.RiftPrototype, _transform.GetMapCoordinates(uid, xform: xform));
|
||||
component.Rifts.Add(carpUid);
|
||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Radio;
|
||||
using Content.Server.SurveillanceCamera;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Emp;
|
||||
@@ -11,6 +12,7 @@ namespace Content.Server.Emp;
|
||||
public sealed class EmpSystem : SharedEmpSystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public const string EmpPulseEffectPrototype = "EffectEmpPulse";
|
||||
|
||||
@@ -102,7 +104,7 @@ public sealed class EmpSystem : SharedEmpSystem
|
||||
|
||||
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
EmpPulse(_transform.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Coordinates.Helpers;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems;
|
||||
@@ -15,6 +16,7 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapMan = default!;
|
||||
[Dependency] private readonly SmokeSystem _smoke = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -26,14 +28,15 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
|
||||
var mapCoords = _transform.GetMapCoordinates(uid, xform);
|
||||
if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(xform.MapPosition);
|
||||
var coords = grid.MapToGrid(mapCoords);
|
||||
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
|
||||
if (!TryComp<SmokeComponent>(ent, out var smoke))
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.Fluids.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -31,6 +32,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -161,7 +163,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
|
||||
puddles.Clear();
|
||||
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates(uid, xform), drain.Range))
|
||||
{
|
||||
// No InRangeUnobstructed because there's no collision group that fits right now
|
||||
// and these are placed by mappers and not buildable/movable so shouldnt really be a problem...
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Server.RoundEnd;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Points;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -25,6 +26,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
|
||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -97,7 +99,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
|
||||
|
||||
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
|
||||
EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
|
||||
EntityManager.SpawnEntities(_transform.GetMapCoordinates(ev.Entity), spawns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.EntityList;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -18,6 +19,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
[Dependency] private readonly DestructibleSystem _destructible = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -61,7 +63,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
if (component.MappedLoot == null)
|
||||
return;
|
||||
|
||||
var pos = Transform(gatheredUid).MapPosition;
|
||||
var pos = _transform.GetMapCoordinates(gatheredUid);
|
||||
|
||||
foreach (var (tag, table) in component.MappedLoot)
|
||||
{
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Content.Server.Guardian
|
||||
var hostXform = Transform(args.Args.Target.Value);
|
||||
var host = EnsureComp<GuardianHostComponent>(args.Args.Target.Value);
|
||||
// Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess.
|
||||
var guardian = Spawn(component.GuardianProto, hostXform.MapPosition);
|
||||
var guardian = Spawn(component.GuardianProto, _transform.GetMapCoordinates(args.Args.Target.Value, xform: hostXform));
|
||||
|
||||
_container.Insert(guardian, host.GuardianContainer);
|
||||
host.HostedGuardian = guardian;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.Kitchen;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -28,6 +29,7 @@ public sealed class SharpSystem : EntitySystem
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
|
||||
@@ -101,7 +103,7 @@ public sealed class SharpSystem : EntitySystem
|
||||
}
|
||||
|
||||
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
||||
var coords = Transform(args.Args.Target.Value).MapPosition;
|
||||
var coords = _transform.GetMapCoordinates(args.Args.Target.Value);
|
||||
EntityUid popupEnt = default!;
|
||||
foreach (var proto in spawnEntities)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Beam;
|
||||
using Content.Server.Beam.Components;
|
||||
using Content.Server.Lightning.Components;
|
||||
using Content.Shared.Lightning;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Lightning;
|
||||
@@ -20,6 +21,7 @@ public sealed class LightningSystem : SharedLightningSystem
|
||||
[Dependency] private readonly BeamSystem _beam = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -74,7 +76,7 @@ public sealed class LightningSystem : SharedLightningSystem
|
||||
//To Do: This is still pretty bad for perf but better than before and at least it doesn't re-allocate
|
||||
// several hashsets every time
|
||||
|
||||
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(Transform(user).MapPosition, range).ToList();
|
||||
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(_transform.GetMapCoordinates(user), range).ToList();
|
||||
_random.Shuffle(targets);
|
||||
targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Server.Lightning;
|
||||
using Content.Server.Lightning.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Tesla.EntitySystems;
|
||||
|
||||
@@ -12,6 +13,7 @@ public sealed class LightningTargetSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -29,7 +31,7 @@ public sealed class LightningTargetSystem : EntitySystem
|
||||
if (uid.Comp.LightningExplode)
|
||||
{
|
||||
_explosionSystem.QueueExplosion(
|
||||
Transform(uid).MapPosition,
|
||||
_transform.GetMapCoordinates(uid),
|
||||
uid.Comp.ExplosionPrototype,
|
||||
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
||||
uid.Comp.MaxTileIntensity,
|
||||
|
||||
@@ -454,7 +454,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
}
|
||||
|
||||
var targetPos = steering.Coordinates.ToMap(EntityManager, _transform);
|
||||
var ourPos = xform.MapPosition;
|
||||
var ourPos = _transform.GetMapCoordinates(uid, xform: xform);
|
||||
|
||||
PrunePath(uid, ourPos, targetPos.Position - ourPos.Position, result.Path);
|
||||
steering.CurrentPath = new Queue<PathPoly>(result.Path);
|
||||
|
||||
@@ -372,7 +372,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
if (compQuery.Components.Count == 0)
|
||||
return;
|
||||
|
||||
var mapPos = _xformQuery.GetComponent(owner).MapPosition;
|
||||
var mapPos = _transform.GetMapCoordinates(owner, xform: _xformQuery.GetComponent(owner));
|
||||
_compTypes.Clear();
|
||||
var i = -1;
|
||||
EntityPrototype.ComponentRegistryEntry compZero = default!;
|
||||
|
||||
@@ -450,7 +450,7 @@ public sealed class NukeSystem : EntitySystem
|
||||
if (stationUid != null)
|
||||
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true);
|
||||
|
||||
var pos = nukeXform.MapPosition;
|
||||
var pos = _transform.GetMapCoordinates(uid, xform: nukeXform);
|
||||
var x = (int) pos.X;
|
||||
var y = (int) pos.Y;
|
||||
var posText = $"({x}, {y})";
|
||||
|
||||
@@ -31,6 +31,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems;
|
||||
|
||||
@@ -52,6 +53,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly StackSystem _stack = default!;
|
||||
[Dependency] private readonly StomachSystem _stomach = default!;
|
||||
[Dependency] private readonly UtensilSystem _utensil = default!;
|
||||
@@ -150,7 +152,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
return (false, true);
|
||||
|
||||
// TODO make do-afters account for fixtures in the range check.
|
||||
if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance))
|
||||
if (!_transform.GetMapCoordinates(user).InRange(_transform.GetMapCoordinates(target), MaxFeedDistance))
|
||||
{
|
||||
var message = Loc.GetString("interaction-system-user-interaction-cannot-reach");
|
||||
_popup.PopupEntity(message, user, user);
|
||||
@@ -325,7 +327,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
}
|
||||
|
||||
//We're empty. Become trash.
|
||||
var position = Transform(food).MapPosition;
|
||||
var position = _transform.GetMapCoordinates(food);
|
||||
var finisher = Spawn(component.Trash, position);
|
||||
|
||||
// If the user is holding the item
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Content.Server.PDA.Ringer
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
private readonly Dictionary<NetUserId, TimeSpan> _lastSetRingtoneAt = new();
|
||||
|
||||
@@ -210,7 +211,7 @@ namespace Content.Server.PDA.Ringer
|
||||
|
||||
_audio.PlayEntity(
|
||||
GetSound(ringer.Ringtone[ringer.NoteCount]),
|
||||
Filter.Empty().AddInRange(ringerXform.MapPosition, ringer.Range),
|
||||
Filter.Empty().AddInRange(_transform.GetMapCoordinates(uid, ringerXform), ringer.Range),
|
||||
uid,
|
||||
true,
|
||||
AudioParams.Default.WithMaxDistance(ringer.Range).WithVolume(ringer.Volume)
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Payload.EntitySystems;
|
||||
|
||||
@@ -17,6 +18,7 @@ public sealed class PayloadSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
||||
@@ -158,7 +160,7 @@ public sealed class PayloadSystem : EntitySystem
|
||||
var solStringB = SolutionContainerSystem.ToPrettyString(solutionB);
|
||||
|
||||
_adminLogger.Add(LogType.ChemicalReaction,
|
||||
$"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {Transform(entity.Owner).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
|
||||
$"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {_transform.GetMapCoordinates(entity.Owner):location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
|
||||
|
||||
solutionA.MaxVolume += solutionB.MaxVolume;
|
||||
_solutionContainerSystem.TryAddSolution(solnA.Value, solutionB);
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
(eyeComp.VisibilityMask & layer) == 0)
|
||||
return false;
|
||||
|
||||
return Transform(ent).MapPosition.InRange(Transform(player).MapPosition, PointingRange);
|
||||
return _transform.GetMapCoordinates(ent).InRange(_transform.GetMapCoordinates(player), PointingRange);
|
||||
}
|
||||
|
||||
var viewers = Filter.Empty()
|
||||
|
||||
@@ -95,7 +95,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
{
|
||||
var xform = Transform(entityGridUid.Value);
|
||||
var pos = xform.Coordinates;
|
||||
var mapPos = xform.MapPosition;
|
||||
var mapPos = _transform.GetMapCoordinates(entityGridUid.Value, xform: xform);
|
||||
var circle = new Circle(mapPos.Position, 2);
|
||||
|
||||
var found = false;
|
||||
|
||||
@@ -165,7 +165,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
var range2 = range * range;
|
||||
var xformQuery = EntityManager.GetEntityQuery<TransformComponent>();
|
||||
var epicenter = _xformSystem.GetWorldPosition(xform, xformQuery);
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, range, flags: LookupFlags.Uncontained))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates(uid, xform), range, flags: LookupFlags.Uncontained))
|
||||
{
|
||||
if (entity == uid)
|
||||
continue;
|
||||
@@ -295,7 +295,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
if (!Resolve(uid, ref xform) || !Resolve(uid, ref eventHorizon))
|
||||
return;
|
||||
|
||||
var mapPos = xform.MapPosition;
|
||||
var mapPos = _xformSystem.GetMapCoordinates(uid, xform: xform);
|
||||
var box = Box2.CenteredAround(mapPos.Position, new Vector2(range, range));
|
||||
var circle = new Circle(mapPos.Position, range);
|
||||
var grids = new List<Entity<MapGridComponent>>();
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
|
||||
|
||||
public sealed class EmpArtifactSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EmpSystem _emp = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -16,6 +18,6 @@ public sealed class EmpArtifactSystem : EntitySystem
|
||||
|
||||
private void OnActivate(EntityUid uid, EmpArtifactComponent component, ArtifactActivatedEvent args)
|
||||
{
|
||||
_emp.EmpPulse(Transform(uid).MapPosition, component.Range, component.EnergyConsumption, component.DisableDuration);
|
||||
_emp.EmpPulse(_transform.GetMapCoordinates(uid), component.Range, component.EnergyConsumption, component.DisableDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public sealed class SpawnArtifactSystem : EntitySystem
|
||||
if (component.Spawns is not {} spawns)
|
||||
return;
|
||||
|
||||
var artifactCord = Transform(uid).MapPosition;
|
||||
var artifactCord = _transform.GetMapCoordinates(uid);
|
||||
foreach (var spawn in EntitySpawnCollection.GetSpawns(spawns, _random))
|
||||
{
|
||||
var dx = _random.NextFloat(-component.Range, component.Range);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
@@ -16,6 +17,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly TileSystem _tile = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -50,7 +52,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
|
||||
var tempXform = Transform(ent);
|
||||
|
||||
var foo = tempXform.MapPosition.Position - xform.MapPosition.Position;
|
||||
var foo = _transform.GetMapCoordinates(ent, xform: tempXform).Position - _transform.GetMapCoordinates(uid, xform: xform).Position;
|
||||
_throwing.TryThrow(ent, foo*2, component.ThrowStrength, uid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public const string InvokedPort = "link_port";
|
||||
|
||||
@@ -529,7 +530,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
private bool InRange(EntityUid sourceUid, EntityUid sinkUid, float range)
|
||||
{
|
||||
// TODO: This should be using an existing method and also coordinates inrange instead.
|
||||
return Transform(sourceUid).MapPosition.InRange(Transform(sinkUid).MapPosition, range);
|
||||
return _transform.GetMapCoordinates(sourceUid).InRange(_transform.GetMapCoordinates(sinkUid), range);
|
||||
}
|
||||
|
||||
private void SendNewLinkEvent(EntityUid? user, EntityUid sourceUid, string source, EntityUid sinkUid, string sink)
|
||||
|
||||
@@ -210,8 +210,8 @@ namespace Content.Shared.Examine
|
||||
public bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
|
||||
var otherPos = entMan.GetComponent<TransformComponent>(other).MapPosition;
|
||||
var originPos = _transform.GetMapCoordinates(origin);
|
||||
var otherPos = _transform.GetMapCoordinates(other);
|
||||
|
||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ namespace Content.Shared.Examine
|
||||
public bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
|
||||
var originPos = _transform.GetMapCoordinates(origin);
|
||||
var otherPos = other.ToMap(entMan, _transform);
|
||||
|
||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||
@@ -228,7 +228,7 @@ namespace Content.Shared.Examine
|
||||
public bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
|
||||
var originPos = _transform.GetMapCoordinates(origin);
|
||||
|
||||
return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker);
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
var xform = Transform(uid);
|
||||
var coordinateEntity = xform.ParentUid.IsValid() ? xform.ParentUid : uid;
|
||||
var itemXform = Transform(entity);
|
||||
var itemPos = itemXform.MapPosition;
|
||||
var itemPos = TransformSystem.GetMapCoordinates(entity, xform: itemXform);
|
||||
|
||||
if (itemPos.MapId == xform.MapID
|
||||
&& (itemPos.Position - xform.MapPosition.Position).Length() <= MaxAnimationRange
|
||||
&& (itemPos.Position - TransformSystem.GetMapCoordinates(uid, xform: xform).Position).Length() <= MaxAnimationRange
|
||||
&& MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups.
|
||||
{
|
||||
var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, TransformSystem, EntityManager);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Content.Shared.Interaction
|
||||
if (!Resolve(user, ref xform))
|
||||
return false;
|
||||
|
||||
var diff = coordinates - xform.MapPosition.Position;
|
||||
var diff = coordinates - _transform.GetMapCoordinates(user, xform: xform).Position;
|
||||
if (diff.LengthSquared() <= 0.01f)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -665,14 +665,14 @@ namespace Content.Shared.Interaction
|
||||
else
|
||||
{
|
||||
// We'll still do the raycast from the centres but we'll bump the range as we know they're in range.
|
||||
originPos = xformA.MapPosition;
|
||||
originPos = _transform.GetMapCoordinates(origin, xform: xformA);
|
||||
range = (originPos.Position - targetPos.Position).Length();
|
||||
}
|
||||
}
|
||||
// No fixtures, e.g. wallmounts.
|
||||
else
|
||||
{
|
||||
originPos = Transform(origin).MapPosition;
|
||||
originPos = _transform.GetMapCoordinates(origin);
|
||||
var otherParent = Transform(other).ParentUid;
|
||||
targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle;
|
||||
}
|
||||
@@ -826,7 +826,7 @@ namespace Content.Shared.Interaction
|
||||
bool popup = false)
|
||||
{
|
||||
Ignored combinedPredicate = e => e == origin || (predicate?.Invoke(e) ?? false);
|
||||
var originPosition = Transform(origin).MapPosition;
|
||||
var originPosition = _transform.GetMapCoordinates(origin);
|
||||
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, combinedPredicate, ShouldCheckAccess(origin));
|
||||
|
||||
if (!inRange && popup && _gameTiming.IsFirstTimePredicted)
|
||||
|
||||
@@ -77,7 +77,7 @@ public sealed class MagnetPickupSystem : EntitySystem
|
||||
// the problem is that stack pickups delete the original entity, which is fine, but due to
|
||||
// game state handling we can't show a lerp animation for it.
|
||||
var nearXform = Transform(near);
|
||||
var nearMap = nearXform.MapPosition;
|
||||
var nearMap = _transform.GetMapCoordinates(near, xform: nearXform);
|
||||
var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager);
|
||||
|
||||
if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Shared.Tabletop
|
||||
[Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transforms = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem Transforms = default!;
|
||||
[Dependency] private readonly IMapManager _mapMan = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -41,8 +41,8 @@ namespace Content.Shared.Tabletop
|
||||
|
||||
// Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(moved);
|
||||
_transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
|
||||
_transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
|
||||
Transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
|
||||
Transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
|
||||
}
|
||||
|
||||
private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)
|
||||
|
||||
@@ -220,7 +220,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
||||
_blocker.UpdateCanMove(target);
|
||||
|
||||
// Invisible tether entity
|
||||
var tether = Spawn("TetherEntity", Transform(target).MapPosition);
|
||||
var tether = Spawn("TetherEntity", TransformSystem.GetMapCoordinates(target));
|
||||
var tetherPhysics = Comp<PhysicsComponent>(tether);
|
||||
component.TetherEntity = tether;
|
||||
_physics.WakeBody(tether);
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract partial class SharedGunSystem
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
ManualCycle(uid, component, Transform(uid).MapPosition, args.User);
|
||||
ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public abstract partial class SharedGunSystem
|
||||
{
|
||||
Text = Loc.GetString("gun-ballistic-cycle"),
|
||||
Disabled = GetBallisticShots(component) == 0,
|
||||
Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User),
|
||||
Act = () => ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user