mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Replace every usage of GridCoordinates with EntityCoordinates (#1280)
* Added struct skeleton for EntityCoordinates. * Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms * Doc cleanup * Remove useless code * Return offset 0 when you don't have a parent * Test for making sure EntityCoordinates for entities without parents have offset 0 * Use parent transform's GridId for GetGridId. * Adds various methods, checks and tests * Replace GridCoordinates with EntityCoordinates * EyeManager.WorldToScreen fix * Address reviews * Fix za buildo * Fix one transform test * Fix the remaining tests * Remove duplicate * Remove another merge duplicate * Fix property * Rename most usages of GridCoordinates to EntityCoordinates. * Add WithEntityId method to EntityCoordinates. * Fix EntityCoordinates usage in GetEntitiesInRange * Remove cursed IMapGrid method, change naming. * Makes GridTileLookupSystem use EntityCoordinates Co-authored-by: Acruid <shatter66@gmail.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
@@ -27,14 +27,19 @@ namespace Robust.Shared.Scripting
|
||||
|
||||
public IEnumerable<EntityPrototype> eprotos => prot.EnumeratePrototypes<EntityPrototype>();
|
||||
|
||||
public GridCoordinates gpos(double x, double y, int gridId)
|
||||
public EntityCoordinates gpos(double x, double y, int gridId)
|
||||
{
|
||||
return new GridCoordinates((float)x, (float)y, new GridId(gridId));
|
||||
return gpos(x, y, new GridId(gridId));
|
||||
}
|
||||
|
||||
public GridCoordinates gpos(double x, double y, GridId gridId)
|
||||
public EntityCoordinates gpos(double x, double y, GridId gridId)
|
||||
{
|
||||
return new GridCoordinates((float)x, (float)y, gridId);
|
||||
if (!map.TryGetGrid(gridId, out var grid))
|
||||
{
|
||||
return new EntityCoordinates(EntityUid.Invalid, ((float) x, (float) y));
|
||||
}
|
||||
|
||||
return new EntityCoordinates(grid.GridEntityId, ((float) x, (float) y));
|
||||
}
|
||||
|
||||
public EntityUid eid(int i)
|
||||
@@ -62,7 +67,7 @@ namespace Robust.Shared.Scripting
|
||||
return map.GetGrid(mapId);
|
||||
}
|
||||
|
||||
public IEntity spawn(string prototype, GridCoordinates position)
|
||||
public IEntity spawn(string prototype, EntityCoordinates position)
|
||||
{
|
||||
return ent.SpawnEntity(prototype, position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user