From 4aa74c5e1dfa7adeda93e86053d93ef1b0fc2e45 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:20:47 -0400 Subject: [PATCH] improve meteor spawning (#29057) --- Content.Server/StationEvents/Events/MeteorSwarmSystem.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs b/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs index 6a67930c4d..3f51834e3a 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs @@ -66,7 +66,14 @@ public sealed class MeteorSwarmSystem : GameRuleSystem : new Random(uid.Id).NextAngle(); var offset = angle.RotateVec(new Vector2((maximumDistance - minimumDistance) * RobustRandom.NextFloat() + minimumDistance, 0)); - var subOffset = RobustRandom.NextAngle().RotateVec(new Vector2( (playableArea.TopRight - playableArea.Center).Length() / 2 * RobustRandom.NextFloat(), 0)); + + // the line at which spawns occur is perpendicular to the offset. + // This means the meteors are less likely to bunch up and hit the same thing. + var subOffsetAngle = RobustRandom.Prob(0.5f) + ? angle + Math.PI / 2 + : angle - Math.PI / 2; + var subOffset = subOffsetAngle.RotateVec(new Vector2( (playableArea.TopRight - playableArea.Center).Length() / 3 * RobustRandom.NextFloat(), 0)); + var spawnPosition = new MapCoordinates(center + offset + subOffset, mapId); var meteor = Spawn(spawnProto, spawnPosition); var physics = Comp(meteor); -- 2.51.2