From 1e667946b35c96b7c696becbae17887851101978 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 18 Sep 2019 12:46:11 -0400 Subject: [PATCH] Bugfixes --- .../io/anuke/mindustry/AndroidLauncher.java | 2 ++ .../world/blocks/distribution/MassDriver.java | 29 ++++++++++--------- .../world/blocks/storage/CoreBlock.java | 6 ++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 97443f0d3b..138d00c224 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -76,6 +76,8 @@ public class AndroidLauncher extends AndroidApplication{ if(code == Activity.RESULT_OK && in != null && in.getData() != null){ Uri uri = in.getData(); + if(uri.getPath().contains("(invalid)")) return; + Core.app.post(() -> Core.app.post(() -> cons.accept(new FileHandle(uri.getPath()){ @Override public InputStream read(){ diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java index 2bce0d1904..60822e9f08 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -12,7 +12,6 @@ import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.Effects.*; import io.anuke.mindustry.entities.type.*; -import io.anuke.mindustry.entities.type.Bullet; import io.anuke.mindustry.gen.*; import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.type.*; @@ -120,26 +119,28 @@ public class MassDriver extends Block{ if( tile.entity.items.total() >= minDistribute && //must shoot minimum amount of items - link.block().itemCapacity - link.entity.items.total() >= minDistribute && //must have minimum amount of space - entity.reload <= 0.0001f //must have reloaded + link.block().itemCapacity - link.entity.items.total() >= minDistribute //must have minimum amount of space ){ MassDriverEntity other = link.entity(); other.waitingShooters.add(tile); - //align to target location - entity.rotation = Mathf.slerpDelta(entity.rotation, targetRotation, rotateSpeed * entity.power.satisfaction); + if(entity.reload <= 0.0001f){ - //fire when it's the first in the queue and angles are ready. - if(other.currentShooter() == tile && + //align to target location + entity.rotation = Mathf.slerpDelta(entity.rotation, targetRotation, rotateSpeed * entity.power.satisfaction); + + //fire when it's the first in the queue and angles are ready. + if(other.currentShooter() == tile && other.state == DriverState.accepting && Angles.near(entity.rotation, targetRotation, 2f) && Angles.near(other.rotation, targetRotation + 180f, 2f)){ - //actually fire - fire(tile, link); - //remove waiting shooters, it's done firing - other.waitingShooters.remove(tile); - //set both states to idle - entity.state = DriverState.idle; - other.state = DriverState.idle; + //actually fire + fire(tile, link); + //remove waiting shooters, it's done firing + other.waitingShooters.remove(tile); + //set both states to idle + entity.state = DriverState.idle; + other.state = DriverState.idle; + } } } } diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java index 5cafa70f57..ec7cd5f616 100644 --- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java @@ -97,8 +97,10 @@ public class CoreBlock extends StorageBlock{ entity.storageCapacity += other.block().itemCapacity + other.entity.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0); } - for(Item item : content.items()){ - entity.items.set(item, Math.min(entity.items.get(item), entity.storageCapacity)); + if(!world.isGenerating()){ + for(Item item : content.items()){ + entity.items.set(item, Math.min(entity.items.get(item), entity.storageCapacity)); + } } for(Tile other : state.teams.get(tile.getTeam()).cores){