Move vgroid much closer (#29943)

* Move vgroid much closer

General feedback is map spam + it takes too long to get to. This is somewhat "close" (considering 1/4 of the distance is the vgroid itself) but without a jetpack / shuttle it's going to be an endeavour.

* Decrease max

* Tweaks

* godzilla

* Update Content.Server/Shuttles/Components/GridSpawnComponent.cs
This commit is contained in:
metalgearsloth
2024-07-28 13:14:18 +10:00
committed by GitHub
parent e3d7c1bd6e
commit 093054f7e3
4 changed files with 29 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ using Content.Shared.Shuttles.Components;
using Content.Shared.Station.Components;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
using Robust.Shared.Utility;
@@ -86,9 +87,15 @@ public sealed partial class ShuttleSystem
_mapManager.DeleteMap(mapId);
}
private bool TryDungeonSpawn(EntityUid targetGrid, EntityUid stationUid, MapId mapId, DungeonSpawnGroup group, out EntityUid spawned)
private bool TryDungeonSpawn(Entity<MapGridComponent?> targetGrid, EntityUid stationUid, MapId mapId, DungeonSpawnGroup group, out EntityUid spawned)
{
spawned = EntityUid.Invalid;
if (!_gridQuery.Resolve(targetGrid.Owner, ref targetGrid.Comp))
{
return false;
}
var dungeonProtoId = _random.Pick(group.Protos);
if (!_protoManager.TryIndex(dungeonProtoId, out var dungeonProto))
@@ -96,11 +103,13 @@ public sealed partial class ShuttleSystem
return false;
}
var spawnCoords = new EntityCoordinates(targetGrid, Vector2.Zero);
var targetPhysics = _physicsQuery.Comp(targetGrid);
var spawnCoords = new EntityCoordinates(targetGrid, targetPhysics.LocalCenter);
if (group.MinimumDistance > 0f)
{
spawnCoords = spawnCoords.Offset(_random.NextVector2(group.MinimumDistance, group.MinimumDistance * 1.5f));
var distancePadding = MathF.Max(targetGrid.Comp.LocalAABB.Width, targetGrid.Comp.LocalAABB.Height);
spawnCoords = spawnCoords.Offset(_random.NextVector2(distancePadding + group.MinimumDistance, distancePadding + group.MaximumDistance));
}
var spawnMapCoords = _transform.ToMapCoordinates(spawnCoords);