Random offset for DefaultGrid every round (#4411)
* Random offset for DefaultGrid every round This is useful to make coders aware of entitycoordinates and mapcoordinates being different and to help spot problems early. It also puts the onus of fixing positioning bugs back onto the original coder rather than someone else if they happen to spot it. * Fix clickable test * Fix entitysystemextensions
This commit is contained in:
@@ -11,6 +11,7 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -62,6 +63,11 @@ namespace Content.Server.GameTicking
|
||||
throw new InvalidOperationException($"No grid found for map {map}");
|
||||
}
|
||||
|
||||
var maxStationOffset = _configurationManager.GetCVar(CCVars.MaxStationOffset);
|
||||
var x = _robustRandom.NextFloat() * maxStationOffset * 2 - maxStationOffset;
|
||||
var y = _robustRandom.NextFloat() * maxStationOffset * 2 - maxStationOffset;
|
||||
_entityManager.GetEntity(grid.GridEntityId).Transform.LocalPosition = new Vector2(x, y);
|
||||
|
||||
DefaultGridId = grid.Index;
|
||||
_spawnPoint = grid.ToCoordinates();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user