Move mining roid and magnet pulls closer (#31296)
move mining roid and magnet pulls closer
This commit is contained in:
parent
d2f733ae93
commit
652ce96239
|
|
@ -3,5 +3,16 @@ namespace Content.Server.Salvage.Magnet;
|
|||
[RegisterComponent]
|
||||
public sealed partial class SalvageMagnetComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The max distance at which the magnet will pull in wrecks.
|
||||
/// Scales from 50% to 100%.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float MagnetSpawnDistance = 128f;
|
||||
|
||||
/// <summary>
|
||||
/// How far offset to either side will the magnet wreck spawn.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float LateralOffset = 32f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ public sealed partial class SalvageSystem
|
|||
worldAngle = _random.NextAngle();
|
||||
}
|
||||
|
||||
if (!TryGetSalvagePlacementLocation(mapId, attachedBounds, bounds!.Value, worldAngle, out var spawnLocation, out var spawnAngle))
|
||||
if (!TryGetSalvagePlacementLocation(magnet, mapId, attachedBounds, bounds!.Value, worldAngle, out var spawnLocation, out var spawnAngle))
|
||||
{
|
||||
Report(magnet.Owner, MagnetChannel, "salvage-system-announcement-spawn-no-debris-available");
|
||||
_mapManager.DeleteMap(salvMapXform.MapID);
|
||||
|
|
@ -390,22 +390,19 @@ public sealed partial class SalvageSystem
|
|||
RaiseLocalEvent(ref active);
|
||||
}
|
||||
|
||||
private bool TryGetSalvagePlacementLocation(MapId mapId, Box2Rotated attachedBounds, Box2 bounds, Angle worldAngle, out MapCoordinates coords, out Angle angle)
|
||||
private bool TryGetSalvagePlacementLocation(Entity<SalvageMagnetComponent> magnet, MapId mapId, Box2Rotated attachedBounds, Box2 bounds, Angle worldAngle, out MapCoordinates coords, out Angle angle)
|
||||
{
|
||||
// Grid intersection only does AABB atm.
|
||||
var attachedAABB = attachedBounds.CalcBoundingBox();
|
||||
|
||||
var minDistance = (attachedAABB.Height < attachedAABB.Width ? attachedAABB.Width : attachedAABB.Height) / 2f;
|
||||
var minActualDistance = bounds.Height < bounds.Width ? minDistance + bounds.Width / 2f : minDistance + bounds.Height / 2f;
|
||||
|
||||
var attachedCenter = attachedAABB.Center;
|
||||
var fraction = 0.25f;
|
||||
var magnetPos = _transform.GetWorldPosition(magnet) + worldAngle.ToVec() * bounds.MaxDimension;
|
||||
var origin = attachedAABB.ClosestPoint(magnetPos);
|
||||
var fraction = 0.50f;
|
||||
|
||||
// Thanks 20kdc
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
var randomPos = attachedCenter +
|
||||
worldAngle.ToVec() * (minActualDistance * fraction);
|
||||
var randomPos = origin +
|
||||
worldAngle.ToVec() * (magnet.Comp.MagnetSpawnDistance * fraction) +
|
||||
(worldAngle + Math.PI / 2).ToVec() * _random.NextFloat(-magnet.Comp.LateralOffset, magnet.Comp.LateralOffset);
|
||||
var finalCoords = new MapCoordinates(randomPos, mapId);
|
||||
|
||||
angle = _random.NextAngle();
|
||||
|
|
@ -417,7 +414,7 @@ public sealed partial class SalvageSystem
|
|||
if (_mapManager.FindGridsIntersecting(finalCoords.MapId, box2Rot).Any())
|
||||
{
|
||||
// Bump it further and further just in case.
|
||||
fraction += 0.25f;
|
||||
fraction += 0.1f;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@
|
|||
- /Maps/Ruins/DeltaV/whiteship_ancient.yml #Delta V - Move to DV folder
|
||||
- /Maps/Ruins/DeltaV/whiteship_bluespacejumper.yml #Delta V - Move to DV folder
|
||||
vgroid: !type:DungeonSpawnGroup
|
||||
minimumDistance: 400
|
||||
maximumDistance: 450
|
||||
minimumDistance: 300
|
||||
maximumDistance: 350
|
||||
nameDataset: names_borer
|
||||
stationGrid: false
|
||||
addComponents:
|
||||
|
|
|
|||
Loading…
Reference in New Issue