From d868ff81bfe29df2116eeead624c692afee6200c Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 30 Nov 2020 17:49:20 -0500 Subject: [PATCH] Dependency resolution fix --- core/assets/bundles/bundle.properties | 2 +- core/src/mindustry/content/Liquids.java | 1 - .../src/mindustry/ui/dialogs/PlanetDialog.java | 5 +++-- core/src/mindustry/world/Block.java | 18 ++++++++---------- .../mindustry/world/consumers/Consumers.java | 8 ++++++++ 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 4854fcd313..37306b5814 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1251,7 +1251,7 @@ hint.mine = Move near the \uf8c4 copper ore and [accent]tap[] it to mine manuall hint.desktopShoot = [accent][[Left-click][] to shoot. hint.depositItems = To transfer items, drag from your ship to the core. hint.respawn = To respawn as a ship, press [accent][[V][]. -hint.respawn.mobile = You have switched control a unit/structure. To respawn as a ship, [accent]tap the avatar in the top left.[] +hint.respawn.mobile = You have switched control to a unit/structure. To respawn as a ship, [accent]tap the avatar in the top left.[] hint.desktopPause = Press [accent][[Space][] to pause and unpause the game. hint.placeDrill = Select the \ue85e [accent]Drill[] tab in the menu at the bottom right, then select a \uf870 [accent]Drill[] and click on a copper patch to place it. hint.placeDrill.mobile = Select the \ue85e[accent]Drill[] tab in the menu at the bottom right, then select a \uf870 [accent]Drill[] and tap on a copper patch to place it.\n\nPress the \ue800 [accent]checkmark[] at the bottom right to confirm. diff --git a/core/src/mindustry/content/Liquids.java b/core/src/mindustry/content/Liquids.java index 91b7186f6b..b087b41a94 100644 --- a/core/src/mindustry/content/Liquids.java +++ b/core/src/mindustry/content/Liquids.java @@ -13,7 +13,6 @@ public class Liquids implements ContentList{ water = new Liquid("water", Color.valueOf("596ab8")){{ heatCapacity = 0.4f; effect = StatusEffects.wet; - alwaysUnlocked = true; }}; slag = new Liquid("slag", Color.valueOf("ffa166")){{ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 710fc29895..4a96776cf6 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -249,9 +249,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ boolean canSelect(Sector sector){ if(mode == select) return sector.hasBase(); + //preset sectors can only be selected once unlocked + if(sector.preset != null) return sector.preset.unlocked() || sector.hasBase(); - return sector.hasBase() || sector.near().contains(Sector::hasBase) //near an occupied sector - || (sector.preset != null && sector.preset.unlocked()); //is an unlocked preset + return sector.hasBase() || sector.near().contains(Sector::hasBase); //near an occupied sector } Sector findLauncher(Sector to){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 5e38bfa8a8..1bce0ffb2d 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -632,18 +632,16 @@ public class Block extends UnlockableContent{ cons.get(stack.item); } - if(consumes.any()){ - //also requires inputs - for(Consume c : consumes.all()){ - if(c instanceof ConsumeItems i){ - for(ItemStack stack : i.items){ - cons.get(stack.item); - } - }else if(c instanceof ConsumeLiquid i){ - cons.get(i.liquid); + //also requires inputs + consumes.each(c -> { + if(c instanceof ConsumeItems i){ + for(ItemStack stack : i.items){ + cons.get(stack.item); } + }else if(c instanceof ConsumeLiquid i){ + cons.get(i.liquid); } - } + }); } @Override diff --git a/core/src/mindustry/world/consumers/Consumers.java b/core/src/mindustry/world/consumers/Consumers.java index ee0c76a2a7..73ad0b0b96 100644 --- a/core/src/mindustry/world/consumers/Consumers.java +++ b/core/src/mindustry/world/consumers/Consumers.java @@ -20,6 +20,14 @@ public class Consumers{ return results != null && results.length > 0; } + public void each(Cons c){ + for(var cons : map){ + if(cons != null){ + c.get(cons); + } + } + } + public void init(){ results = Structs.filter(Consume.class, map, m -> m != null); optionalResults = Structs.filter(Consume.class, map, m -> m != null && m.isOptional());