]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
improve meteor spawning (#29057)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Mon, 17 Jun 2024 05:20:47 +0000 (01:20 -0400)
committerGitHub <noreply@github.com>
Mon, 17 Jun 2024 05:20:47 +0000 (01:20 -0400)
Content.Server/StationEvents/Events/MeteorSwarmSystem.cs

index 6a67930c4d2468ff56f323cebc961bed21ec9b0a..3f51834e3a681947762df2d3b51d89297a8d752a 100644 (file)
@@ -66,7 +66,14 @@ public sealed class MeteorSwarmSystem : GameRuleSystem<MeteorSwarmComponent>
                 : 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<PhysicsComponent>(meteor);