diff --git a/build.gradle b/build.gradle index 7886a6577b..593cc460f1 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ allprojects { appName = 'Mindustry' gdxVersion = '1.9.8' roboVMVersion = '2.3.0' - uCoreVersion = '6a727b957e' + uCoreVersion = '9969ed07b1' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index f455ae3ab1..0896b7baf2 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -198,6 +198,7 @@ text.builtin=Built-In text.map.delete.confirm=Are you sure you want to delete this map? This action cannot be undone! text.map.random=[accent]Random Map text.map.nospawn=This map does not have any cores for the player to spawn in! Add a [ROYAL]blue[] core to this map in the editor. +text.map.invalid=Error loading map: corrupted or invalid map file. text.editor.brush=Brush text.editor.slope=\\ text.editor.openin=Open In Editor diff --git a/core/src/io/anuke/mindustry/core/World.java b/core/src/io/anuke/mindustry/core/World.java index ba0dfd1cc1..755d439faf 100644 --- a/core/src/io/anuke/mindustry/core/World.java +++ b/core/src/io/anuke/mindustry/core/World.java @@ -256,7 +256,18 @@ public class World extends Module{ EntityPhysics.resizeTree(0, 0, width * tilesize, height * tilesize); - generator.loadTileData(tiles, MapIO.readTileData(map, true), map.meta.hasOreGen(), 0); + try{ + generator.loadTileData(tiles, MapIO.readTileData(map, true), map.meta.hasOreGen(), 0); + } catch(Exception e){ + Log.err(e); + if(!headless){ + ui.showError("$text.map.invalid"); + threads.runDelay(() -> state.set(State.menu)); + invalidMap = true; + } + generating = false; + return; + } if(!headless && state.teams.get(players[0].getTeam()).cores.size == 0){ ui.showError("$text.map.nospawn"); diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 9fd32cde63..ac48267cf4 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -83,6 +83,7 @@ public abstract class InputHandler extends InputAdapter{ int sent = Mathf.clamp(accepted / 4, 1, 8); int removed = accepted / sent; int[] remaining = {accepted, accepted}; + Block block = tile.block(); for(int i = 0; i < sent; i++){ boolean end = i == sent - 1; @@ -92,6 +93,7 @@ public abstract class InputHandler extends InputAdapter{ ItemTransfer.create(stack.item, player.x + Angles.trnsx(player.rotation + 180f, backTrns), player.y + Angles.trnsy(player.rotation + 180f, backTrns), new Translator(tile.drawx() + stackTrns.x, tile.drawy() + stackTrns.y), () -> { + if(tile.block() != block) return; tile.block().handleStack(stack.item, removed, tile, player); remaining[1] -= removed; diff --git a/core/src/io/anuke/mindustry/type/Recipe.java b/core/src/io/anuke/mindustry/type/Recipe.java index 5cf2add83f..43814cc620 100644 --- a/core/src/io/anuke/mindustry/type/Recipe.java +++ b/core/src/io/anuke/mindustry/type/Recipe.java @@ -34,6 +34,7 @@ public class Recipe implements UnlockableContent{ public final float cost; public boolean desktopOnly = false, debugOnly = false; + //the only gamemode in which the recipe shows up public GameMode targetMode; private Block[] dependencies; diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java index a8bec8c381..b8373fc3b7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java @@ -77,6 +77,12 @@ public class Conveyor extends Block{ @Override public void drawShadow(Tile tile){ + //fixes build block crash + if(!(tile.entity instanceof ConveyorEntity)){ + super.drawShadow(tile); + return; + } + ConveyorEntity entity = tile.entity(); if(entity.blendshadowrot == -1){ diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/Vault.java b/core/src/io/anuke/mindustry/world/blocks/storage/Vault.java index 73b8bbd003..09eedd0061 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/Vault.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/Vault.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks.storage; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.content.Items; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.Edges; @@ -54,7 +55,7 @@ public class Vault extends StorageBlock{ if(other == null || !(other.block() instanceof StorageBlock)) continue; - if(other.block() instanceof Vault){ + if(!(other.block() instanceof Vault)){ for(int ii = 0; ii < Item.all().size; ii++){ Item item = Item.getByID(ii); @@ -67,10 +68,10 @@ public class Vault extends StorageBlock{ } } }else{ + todump = Items.tungsten; if(other.block().acceptItem(todump, other, in) && canDump(tile, other, todump)){ - other.block().handleItem(todump, other, in); - tile.entity.items.remove(todump, 1); + other.block().handleItem(removeItem(tile, null), other, in); incrementDump(tile, proximity.size); return true; } diff --git a/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java b/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java index 83b4f6f4ab..524cd8d4f5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/CommandCenter.java @@ -10,6 +10,7 @@ import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.entities.units.UnitCommand; +import io.anuke.mindustry.game.Team; import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.world.Block; @@ -98,7 +99,9 @@ public class CommandCenter extends Block{ } } - for(BaseUnit unit : unitGroups[player.getTeam().ordinal()].all()){ + Team team = (player == null ? tile.getTeam() : player.getTeam()); + + for(BaseUnit unit : unitGroups[team.ordinal()].all()){ unit.onCommand(command); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java index 35f7f3dfce..63d024c79c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/MechFactory.java @@ -45,7 +45,7 @@ public class MechFactory extends Block{ @Remote(targets = Loc.both, called = Loc.server) public static void onMechFactoryTap(Player player, Tile tile){ - if(!checkValidTap(tile, player)) return; + if(player == null || !checkValidTap(tile, player)) return; MechFactoryEntity entity = tile.entity(); player.beginRespawning(entity);