diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs index 1859579e..f082f8b9 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs @@ -80,10 +80,10 @@ public static AsteroidEntity CreateAsteroid(Vector3D position, float size, Vecto return ent; } - public float Size = 3; + public float Size; public string ModelString = ""; public AsteroidType Type; - private float _integrity = 1; + private float _integrity; public void SplitAsteroid() { @@ -175,7 +175,9 @@ private void Init(Vector3D position, float size, Vector3D initialVelocity, Aster ModelString = Path.Combine(modPath, UraniniteAsteroidModels[MainSession.I.Rand.Next(UraniniteAsteroidModels.Length)]); break; } + Size = size; + _integrity = AsteroidSettings.BaseIntegrity * Size; Log.Info($"Attempting to load model: {ModelString}"); @@ -196,7 +198,7 @@ private void Init(Vector3D position, float size, Vector3D initialVelocity, Aster CreatePhysics(); Physics.LinearVelocity = initialVelocity + RandVector() * AsteroidSettings.VelocityVariability; - Physics.AngularVelocity = RandVector() * AsteroidSettings.AngularVelocityVariability; // Set initial angular velocity + Physics.AngularVelocity = RandVector() * AsteroidSettings.GetRandomAngularVelocity(MainSession.I.Rand); // Set initial angular velocity Log.Info($"Asteroid model {ModelString} loaded successfully with initial angular velocity: {Physics.AngularVelocity}"); } @@ -235,4 +237,3 @@ private Vector3D RandVector() } } } - \ No newline at end of file diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs index 973f6440..903e1865 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidSettings.cs @@ -9,12 +9,12 @@ internal static class AsteroidSettings public static int MaxAsteroidCount = 1000; public static int AsteroidSpawnRadius = 10000; public static int AsteroidVelocityBase = 0; - public static double VelocityVariability = 10; // New setting for velocity variability - public static double AngularVelocityVariability = 0.1; // New setting for angular velocity variability + public static double VelocityVariability = 10; + public static double AngularVelocityVariability = 0.1; // Weights for asteroid type frequencies - public static double IceWeight = 0.45; // 45% - public static double StoneWeight = 0.45; // 45% + public static double IceWeight = 0.80; + public static double StoneWeight = 0.11; public static double IronWeight = 0.01; public static double NickelWeight = 0.01; public static double CobaltWeight = 0.01; @@ -25,17 +25,22 @@ internal static class AsteroidSettings public static double PlatinumWeight = 0.01; public static double UraniniteWeight = 0.01; + // New settings for base integrity and size + public static float BaseIntegrity = 1f; + public static float MinAsteroidSize = 1.5f; + public static float MaxAsteroidSize = 500f; + public static SpawnableArea[] ValidSpawnLocations = { - new SpawnableArea - { - CenterPosition = new Vector3D(148001024.50, 1024.50, 1024.50), - Normal = new Vector3D(1, 10, 0.5).Normalized(), - Radius = 60268000 * 2.5, - InnerRadius = 60268000 * 1.2, - HeightFromCenter = 1000, - } - }; + new SpawnableArea + { + CenterPosition = new Vector3D(148001024.50, 1024.50, 1024.50), + Normal = new Vector3D(1, 10, 0.5).Normalized(), + Radius = 60268000 * 2.5, + InnerRadius = 60268000 * 1.2, + HeightFromCenter = 1000, + } + }; public static bool CanSpawnAsteroidAtPoint(Vector3D point, out Vector3D velocity) { @@ -88,8 +93,17 @@ public static AsteroidType GetRandomAsteroidType(Random rand) randomValue -= PlatinumWeight; return AsteroidType.Uraninite; } - } + public static double GetRandomAngularVelocity(Random rand) + { + return AngularVelocityVariability * rand.NextDouble(); + } + + public static float GetRandomAsteroidSize(Random rand) + { + return MinAsteroidSize + (float)rand.NextDouble() * (MaxAsteroidSize - MinAsteroidSize); + } + } internal class SpawnableArea { public Vector3D CenterPosition;