From 4f701a706354ee1465a2f8bad007f1e2f94fd346 Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:14:52 +0800 Subject: [PATCH] `useUnitCap` fun (#9187) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * a * aaaaa * aaaaaaaaaaaa * AAAAAAAAAAAAAAAAAAAAAAA * *inhales* * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * *inhales* * AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * *inhales* * aaaa * AAAAAAAÆEEEEEEEEEEEEEEEE * anyways im stupid * *exhales* * Update core/src/mindustry/world/blocks/units/Reconstructor.java --------- Co-authored-by: Anuken --- core/src/mindustry/entities/Units.java | 2 +- core/src/mindustry/world/blocks/units/Reconstructor.java | 4 ++-- core/src/mindustry/world/blocks/units/UnitAssembler.java | 4 ++-- core/src/mindustry/world/blocks/units/UnitCargoLoader.java | 4 ++-- core/src/mindustry/world/blocks/units/UnitFactory.java | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/mindustry/entities/Units.java b/core/src/mindustry/entities/Units.java index 443e1ff549..998c2c05f3 100644 --- a/core/src/mindustry/entities/Units.java +++ b/core/src/mindustry/entities/Units.java @@ -89,7 +89,7 @@ public class Units{ /** @return whether a new instance of a unit of this team can be created. */ public static boolean canCreate(Team team, UnitType type){ - return team.data().countType(type) < getCap(team) && !type.isBanned(); + return !type.useUnitCap || (team.data().countType(type) < getCap(team) && !type.isBanned()); } public static int getCap(Team team){ diff --git a/core/src/mindustry/world/blocks/units/Reconstructor.java b/core/src/mindustry/world/blocks/units/Reconstructor.java index c4da0d2e18..25b6e72226 100644 --- a/core/src/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/mindustry/world/blocks/units/Reconstructor.java @@ -69,10 +69,10 @@ public class Reconstructor extends UnitBlock{ Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(e.unit().name), e.team.data().countType(e.unit()), - Units.getStringCap(e.team) + e.unit() == null || e.unit().useUnitCap ? Units.getStringCap(e.team) : "∞" ), () -> Pal.power, - () -> e.unit() == null ? 0f : (float)e.team.data().countType(e.unit()) / Units.getCap(e.team) + () -> e.unit() == null ? 0f : (e.unit().useUnitCap ? (float)e.team.data().countType(e.unit()) / Units.getCap(e.team) : 1f) )); } diff --git a/core/src/mindustry/world/blocks/units/UnitAssembler.java b/core/src/mindustry/world/blocks/units/UnitAssembler.java index 70034869a9..44165f636f 100644 --- a/core/src/mindustry/world/blocks/units/UnitAssembler.java +++ b/core/src/mindustry/world/blocks/units/UnitAssembler.java @@ -99,10 +99,10 @@ public class UnitAssembler extends PayloadBlock{ Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(e.unit().name), e.team.data().countType(e.unit()), - Units.getStringCap(e.team) + e.unit().useUnitCap ? Units.getStringCap(e.team) : "∞" ), () -> Pal.power, - () -> (float)e.team.data().countType(e.unit()) / Units.getCap(e.team) + () -> e.unit().useUnitCap ? ((float)e.team.data().countType(e.unit()) / Units.getCap(e.team)) : 1f )); } diff --git a/core/src/mindustry/world/blocks/units/UnitCargoLoader.java b/core/src/mindustry/world/blocks/units/UnitCargoLoader.java index 1df671d4ce..ee42fc828e 100644 --- a/core/src/mindustry/world/blocks/units/UnitCargoLoader.java +++ b/core/src/mindustry/world/blocks/units/UnitCargoLoader.java @@ -54,10 +54,10 @@ public class UnitCargoLoader extends Block{ Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(unitType.name), e.team.data().countType(unitType), - Units.getStringCap(e.team) + unitType.useUnitCap ? Units.getStringCap(e.team) : "∞" ), () -> Pal.power, - () -> (float)e.team.data().countType(unitType) / Units.getCap(e.team) + () -> unitType.useUnitCap ? (float)e.team.data().countType(unitType) / Units.getCap(e.team) : 1f )); } diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index 467b725967..7b98b80e2f 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -92,10 +92,10 @@ public class UnitFactory extends UnitBlock{ Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(e.unit().name), e.team.data().countType(e.unit()), - Units.getStringCap(e.team) + e.unit() == null ? Units.getStringCap(e.team) : (e.unit().useUnitCap ? Units.getStringCap(e.team) : "∞") ), () -> Pal.power, - () -> e.unit() == null ? 0f : (float)e.team.data().countType(e.unit()) / Units.getCap(e.team) + () -> e.unit() == null ? 0f : (e.unit().useUnitCap ? (float)e.team.data().countType(e.unit()) / Units.getCap(e.team) : 1f) )); } @@ -362,4 +362,4 @@ public class UnitFactory extends UnitBlock{ } } } -} \ No newline at end of file +}