Center salvage shuttles (#17906)
It looks slightly offset due to localcenter but don't worry about it.
This commit is contained in:
@@ -138,7 +138,7 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
|||||||
expedition.Rewards = mission.Rewards;
|
expedition.Rewards = mission.Rewards;
|
||||||
|
|
||||||
// Don't want consoles to have the incorrect name until refreshed.
|
// Don't want consoles to have the incorrect name until refreshed.
|
||||||
var ftlUid = _entManager.CreateEntityUninitialized("FTLPoint", new EntityCoordinates(mapUid, Vector2.Zero));
|
var ftlUid = _entManager.CreateEntityUninitialized("FTLPoint", new EntityCoordinates(mapUid, grid.TileSizeHalfVector));
|
||||||
_entManager.GetComponent<MetaDataComponent>(ftlUid).EntityName = SharedSalvageSystem.GetFTLName(_prototypeManager.Index<DatasetPrototype>("names_borer"), _missionParams.Seed);
|
_entManager.GetComponent<MetaDataComponent>(ftlUid).EntityName = SharedSalvageSystem.GetFTLName(_prototypeManager.Index<DatasetPrototype>("names_borer"), _missionParams.Seed);
|
||||||
_entManager.InitializeAndStartEntity(ftlUid);
|
_entManager.InitializeAndStartEntity(ftlUid);
|
||||||
|
|
||||||
|
|||||||
@@ -611,23 +611,6 @@ public sealed partial class ShuttleSystem
|
|||||||
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
|
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is pretty crude for multiple landings.
|
|
||||||
if (nearbyGrids.Count > 1 || !HasComp<MapComponent>(targetXform.GridUid))
|
|
||||||
{
|
|
||||||
var minRadius = (MathF.Max(targetAABB.Width, targetAABB.Height) + MathF.Max(shuttleAABB.Width, shuttleAABB.Height)) / 2f;
|
|
||||||
spawnPos = targetAABB.Center + _random.NextVector2(minRadius, minRadius + 64f);
|
|
||||||
}
|
|
||||||
else if (shuttleBody != null)
|
|
||||||
{
|
|
||||||
var (targetPos, targetRot) = _transform.GetWorldPositionRotation(targetXform, xformQuery);
|
|
||||||
var transform = new Transform(targetPos, targetRot);
|
|
||||||
spawnPos = Robust.Shared.Physics.Transform.Mul(transform, -shuttleBody.LocalCenter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos);
|
xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos);
|
||||||
|
|
||||||
if (!HasComp<MapComponent>(targetXform.GridUid))
|
if (!HasComp<MapComponent>(targetXform.GridUid))
|
||||||
@@ -663,8 +646,8 @@ public sealed partial class ShuttleSystem
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var aabb = fixture.Shape.ComputeAABB(transform, 0);
|
var aabb = fixture.Shape.ComputeAABB(transform, 0);
|
||||||
// Double the polygon radius (at least while the radius exists).
|
// Create a small border around it.
|
||||||
aabb = aabb.Enlarged(0.02f);
|
aabb = aabb.Enlarged(0.2f);
|
||||||
aabbs.Add(aabb);
|
aabbs.Add(aabb);
|
||||||
|
|
||||||
foreach (var ent in _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, LookupFlags.Uncontained))
|
foreach (var ent in _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, LookupFlags.Uncontained))
|
||||||
|
|||||||
Reference in New Issue
Block a user