Merge pull request #11641 from abcdefg30/particleDensity
Convert ParticleDensityFactor from a float to an int
This commit is contained in:
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Adds a particle-based overlay.")]
|
[Desc("Adds a particle-based overlay.")]
|
||||||
public class WeatherOverlayInfo : ITraitInfo, ILobbyCustomRulesIgnore
|
public class WeatherOverlayInfo : ITraitInfo, ILobbyCustomRulesIgnore
|
||||||
{
|
{
|
||||||
[Desc("Factor for particle density. As higher as more particles will get spawned.")]
|
[Desc("Average number of particles per 100x100 px square.")]
|
||||||
public readonly float ParticleDensityFactor = 0.0007625f;
|
public readonly int ParticleDensityFactor = 8;
|
||||||
|
|
||||||
[Desc("Should the level of the wind change over time, or just stick to the first value of WindLevels?")]
|
[Desc("Should the level of the wind change over time, or just stick to the first value of WindLevels?")]
|
||||||
public readonly bool ChangingWindLevel = true;
|
public readonly bool ChangingWindLevel = true;
|
||||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
int CalculateParticleCount(int x, int y)
|
int CalculateParticleCount(int x, int y)
|
||||||
{
|
{
|
||||||
return (int)(x * y * info.ParticleDensityFactor);
|
return (int)(x * y * info.ParticleDensityFactor / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnParticles(int count, int rangeY, int spawnChancePercent)
|
void SpawnParticles(int count, int rangeY, int spawnChancePercent)
|
||||||
|
|||||||
@@ -256,6 +256,18 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParticleDensityFactor was converted from a float to an int
|
||||||
|
if (engineVersion < 20160713 && node.Key == "WeatherOverlay")
|
||||||
|
{
|
||||||
|
var density = node.Value.Nodes.FirstOrDefault(n => n.Key == "ParticleDensityFactor");
|
||||||
|
if (density != null)
|
||||||
|
{
|
||||||
|
var value = float.Parse(density.Value.Value, CultureInfo.InvariantCulture);
|
||||||
|
value = (int)Math.Round(value * 10000, 0);
|
||||||
|
density.Value.Value = value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ World:
|
|||||||
BackgroundMusic: rain-ambient
|
BackgroundMusic: rain-ambient
|
||||||
StartingMusic: rain
|
StartingMusic: rain
|
||||||
WeatherOverlay:
|
WeatherOverlay:
|
||||||
ParticleDensityFactor: 0.0007625
|
|
||||||
ChangingWindLevel: true
|
ChangingWindLevel: true
|
||||||
WindLevels: -5, -3, -2, 0, 2, 3, 5
|
WindLevels: -5, -3, -2, 0, 2, 3, 5
|
||||||
WindTick: 150, 550
|
WindTick: 150, 550
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
World:
|
World:
|
||||||
WeatherOverlay:
|
WeatherOverlay:
|
||||||
ParticleDensityFactor: 0.0007625
|
|
||||||
ChangingWindLevel: true
|
ChangingWindLevel: true
|
||||||
WindLevels: -5, -3, -2, 0, 2, 3, 5
|
WindLevels: -5, -3, -2, 0, 2, 3, 5
|
||||||
WindTick: 150, 550
|
WindTick: 150, 550
|
||||||
|
|||||||
Reference in New Issue
Block a user