From 234649bd68982c7a38d631516f61578b5f4f9c68 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 15 Sep 2020 18:20:56 -0400 Subject: [PATCH] Weather tweaks --- core/src/mindustry/ui/dialogs/CustomRulesDialog.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 868875e2cf..294e547510 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -322,7 +322,17 @@ public class CustomRulesDialog extends BaseDialog{ }).width(170f); //reset cooldown to random number - dialog.hidden(() -> rules.weather.each(w -> w.cooldown = Mathf.random(w.minFrequency, w.maxFrequency))); + dialog.hidden(() -> { + float sum = 0; + Seq sh = rules.weather.copy(); + sh.shuffle(); + + for(WeatherEntry w : sh){ + //add the previous cooldowns to the sum so weather events are staggered and don't happen all at once. + w.cooldown = sum + Mathf.random(w.minFrequency, w.maxFrequency); + sum += w.cooldown; + } + }); dialog.show(); }