From 02c03e9c67b2638cb4bfc5ebaea55b9567485fde Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 17:38:09 -0400 Subject: [PATCH] Cleanup & minor layout bugfixes --- core/src/mindustry/ai/types/LogicAI.java | 2 +- core/src/mindustry/audio/SoundControl.java | 2 +- core/src/mindustry/game/SectorInfo.java | 2 +- .../ui/dialogs/CustomRulesDialog.java | 2 +- .../mindustry/ui/dialogs/PlanetDialog.java | 2 +- .../ui/dialogs/SchematicsDialog.java | 22 ++----------------- 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/core/src/mindustry/ai/types/LogicAI.java b/core/src/mindustry/ai/types/LogicAI.java index 3357d36946..193e5aaf48 100644 --- a/core/src/mindustry/ai/types/LogicAI.java +++ b/core/src/mindustry/ai/types/LogicAI.java @@ -17,7 +17,7 @@ public class LogicAI extends AIController{ /** Minimum delay between item transfers. */ public static final float transferDelay = 60f * 1.5f; /** Time after which the unit resets its controlled and reverts to a normal unit. */ - public static final float logicControlTimeout = 10f * 60f; + public static final float logicControlTimeout = 60f * 10f; public LUnitControl control = LUnitControl.idle; public float moveX, moveY, moveRad; diff --git a/core/src/mindustry/audio/SoundControl.java b/core/src/mindustry/audio/SoundControl.java index 00939df0f1..5b29b62a85 100644 --- a/core/src/mindustry/audio/SoundControl.java +++ b/core/src/mindustry/audio/SoundControl.java @@ -17,7 +17,7 @@ import static mindustry.Vars.*; /** Controls playback of multiple audio tracks.*/ public class SoundControl{ - protected static final float finTime = 120f, foutTime = 120f, musicInterval = 60 * 60 * 3f, musicChance = 0.6f, musicWaveChance = 0.46f; + protected static final float finTime = 120f, foutTime = 120f, musicInterval = 3f * Time.toMinutes, musicChance = 0.6f, musicWaveChance = 0.46f; /** normal, ambient music, plays at any time */ public Seq ambientMusic = Seq.with(); diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 8c9f1f1a9e..4d2b20b9cc 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -55,7 +55,7 @@ public class SectorInfo{ /** Waves this sector can survive if under attack. Based on wave in info. <0 means uncalculated. */ public int wavesSurvived = -1; /** Time between waves. */ - public float waveSpacing = 60 * 60 * 2; + public float waveSpacing = 2 * Time.toMinutes; /** Damage dealt to sector. */ public float damage; /** How many waves have passed while the player was away. */ diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 346a9b48bb..3b5978a290 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -263,7 +263,7 @@ public class CustomRulesDialog extends BaseDialog{ rebuild[0] = () -> { base.clearChildren(); - int cols = Math.max(1, Core.graphics.getWidth() / 460); + int cols = Math.max(1, (int)(Core.graphics.getWidth() / Scl.scl(450))); int idx = 0; for(WeatherEntry entry : rules.weather){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 32ed6ee79a..00f29b0a39 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -739,7 +739,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ updateSelected(); }).checked(sector.info.icon == null); - int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f); + int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f)); int i = 1; for(var key : defaultIcons){ diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index a4616af643..cdafcf0e80 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -415,32 +415,14 @@ public class SchematicsDialog extends BaseDialog{ t.marginRight(19f); t.defaults().size(48f); - int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f); - - /* - int i = 0; - for(var key : defaultIcons){ - var value = Icon.icons.get(key); - - t.button(value, Styles.cleari, () -> { - sector.info.icon = key; - sector.info.contentIcon = null; - sector.saveInfo(); - hide(); - updateSelected(); - }).checked(key.equals(sector.info.icon)); - - if(++i % cols == 0) t.row(); - }*/ - - int i = 0; + int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f)); for(ContentType ctype : defaultContentIcons){ t.row(); t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent); t.row(); - i = 0; + int i = 0; for(UnlockableContent u : content.getBy(ctype).as()){ if(!u.isHidden() && u.unlockedNow() && u.hasEmoji() && !tags.contains(u.emoji())){ t.button(new TextureRegionDrawable(u.uiIcon), Styles.cleari, iconMed, () -> {