mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-07 05:50:54 +07:00
Weather tweaks
This commit is contained in:
parent
d655f95b67
commit
234649bd68
@ -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<WeatherEntry> 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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user