From 3a8b2bda43d8e18946410f1011a6f9810c97f1a7 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 25 Jun 2016 19:04:59 +0200 Subject: [PATCH 1/3] Convert ParticleDensityFactor from a float to an int --- OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs index 88d8c99db8..a22ca7ccbd 100644 --- a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs @@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Traits [Desc("Adds a particle-based overlay.")] public class WeatherOverlayInfo : ITraitInfo, ILobbyCustomRulesIgnore { - [Desc("Factor for particle density. As higher as more particles will get spawned.")] - public readonly float ParticleDensityFactor = 0.0007625f; + [Desc("Average number of particles per 100x100 px square.")] + public readonly int ParticleDensityFactor = 8; [Desc("Should the level of the wind change over time, or just stick to the first value of WindLevels?")] public readonly bool ChangingWindLevel = true; @@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits 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) From 39d9832b03f235fd92a499b0c133ad895a197975 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 25 Jun 2016 19:33:55 +0200 Subject: [PATCH 2/3] Remove unnecessary ParticleDensityFactor yaml nodes which only reflected the default value. --- mods/cnc/maps/gdi06/rules.yaml | 1 - mods/ra/maps/snow town/rules.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/mods/cnc/maps/gdi06/rules.yaml b/mods/cnc/maps/gdi06/rules.yaml index 56ac3c5523..3440e9ca87 100644 --- a/mods/cnc/maps/gdi06/rules.yaml +++ b/mods/cnc/maps/gdi06/rules.yaml @@ -5,7 +5,6 @@ World: BackgroundMusic: rain-ambient StartingMusic: rain WeatherOverlay: - ParticleDensityFactor: 0.0007625 ChangingWindLevel: true WindLevels: -5, -3, -2, 0, 2, 3, 5 WindTick: 150, 550 diff --git a/mods/ra/maps/snow town/rules.yaml b/mods/ra/maps/snow town/rules.yaml index 94ff76aad6..80146bdd71 100644 --- a/mods/ra/maps/snow town/rules.yaml +++ b/mods/ra/maps/snow town/rules.yaml @@ -1,6 +1,5 @@ World: WeatherOverlay: - ParticleDensityFactor: 0.0007625 ChangingWindLevel: true WindLevels: -5, -3, -2, 0, 2, 3, 5 WindTick: 150, 550 From df5727ad38c0519001330aa275d1afb0b77c57e4 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 12 Jul 2016 22:17:50 +0200 Subject: [PATCH 3/3] Add an upgrade rule --- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 517fd62a40..843333302d 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -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); }