Rotate DefaultGrid on round start (#4957)

* Rotate DefaultGrid on round start

Not ideal long-term but good for bugspotting short-term.

* Fix buckle test

Because gridtraversal was being triggered the pos was being fucked when moving back

* Fix buckle

* Buckle offset
This commit is contained in:
metalgearsloth
2021-10-25 15:22:57 +11:00
committed by GitHub
parent b60dea5c21
commit 0f513f64fb
5 changed files with 25 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ using Content.Shared.GameTicking;
using Content.Shared.Preferences;
using Prometheus;
using Robust.Server.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
@@ -63,12 +64,19 @@ namespace Content.Server.GameTicking
throw new InvalidOperationException($"No grid found for map {map}");
}
var stationXform = EntityManager.GetComponent<ITransformComponent>(grid.GridEntityId);
if (StationOffset)
{
// Apply a random offset to the station grid entity.
var x = _robustRandom.NextFloat() * MaxStationOffset * 2 - MaxStationOffset;
var y = _robustRandom.NextFloat() * MaxStationOffset * 2 - MaxStationOffset;
EntityManager.GetEntity(grid.GridEntityId).Transform.LocalPosition = new Vector2(x, y);
stationXform.LocalPosition = new Vector2(x, y);
}
if (StationRotation)
{
stationXform.LocalRotation = _robustRandom.NextFloat(MathF.Tau);
}
DefaultGridId = grid.Index;