}
else
{
- if (player.Status != SessionStatus.InGame || player.AttachedEntity is not {Valid: true} playerEntity)
+ if (player.Status != SessionStatus.InGame || player.AttachedEntity is not { Valid: true } playerEntity)
{
shell.WriteLine("You are not in-game!");
return;
var currentMap = _entManager.GetComponent<TransformComponent>(playerEntity).MapID;
var currentGrid = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
+ var xformSystem = _entManager.System<SharedTransformSystem>();
+
var found = GetWarpPointByName(location)
.OrderBy(p => p.Item1, Comparer<EntityCoordinates>.Create((a, b) =>
{
// Sort so that warp points on the same grid/map are first.
// So if you have two maps loaded with the same warp points,
// it will prefer the warp points on the map you're currently on.
- var aGrid = a.GetGridUid(_entManager);
- var bGrid = b.GetGridUid(_entManager);
+ var aGrid = xformSystem.GetGrid(a);
+ var bGrid = xformSystem.GetGrid(b);
if (aGrid == bGrid)
{
return 1;
}
- var mapA = a.GetMapId(_entManager);
- var mapB = a.GetMapId(_entManager);
+ var mapA = xformSystem.GetMapId(a);
+ var mapB = xformSystem.GetMapId(b);
if (mapA == mapB)
{
return;
}
- var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
- var xformSystem = _entManager.System<SharedTransformSystem>();
- xform.Coordinates = coords;
- xformSystem.AttachToGridOrMap(playerEntity, xform);
+ xformSystem.SetCoordinates(playerEntity, coords);
+ xformSystem.AttachToGridOrMap(playerEntity);
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
{
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);