From 581782af28c961282d3bb41dabd2926e30f7601b Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 31 May 2019 09:10:37 -0400 Subject: [PATCH] Mass driver power fix / Bugfixes --- core/assets/bundles/bundle.properties | 2 +- core/src/io/anuke/mindustry/content/Blocks.java | 2 +- .../anuke/mindustry/ui/dialogs/FileChooser.java | 17 +++++++++-------- .../world/blocks/distribution/MassDriver.java | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 1bc26bb6b6..aded4c80ec 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -802,7 +802,7 @@ block.spectre.name = Spectre block.meltdown.name = Meltdown block.container.name = Container block.launch-pad.name = Launch Pad -block.launch-pad.description = Launches batches of items without any need for a core launch. Unfinished. +block.launch-pad.description = Launches batches of items without any need for a core launch. block.launch-pad-large.name = Large Launch Pad team.blue.name = blue team.red.name = red diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index ad2e3a133c..5ddaeb7340 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -943,7 +943,7 @@ public class Blocks implements ContentList{ itemCapacity = 120; reloadTime = 200f; range = 440f; - consumes.power(2f); + consumes.power(1.75f); }}; //endregion diff --git a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java index ca35333bef..99b4a6d055 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java @@ -29,12 +29,21 @@ public class FileChooser extends FloatingDialog{ private Predicate filter; private Consumer selectListener; private boolean open; + private int lastWidth = Core.graphics.getWidth(), lastHeight = Core.graphics.getHeight(); public FileChooser(String title, Predicate filter, boolean open, Consumer result){ super(title); this.open = open; this.filter = filter; this.selectListener = result; + + update(() -> { + if(Core.graphics.getWidth() != lastWidth || Core.graphics.getHeight() != lastHeight){ + updateFiles(false); + lastHeight = Core.graphics.getHeight(); + lastWidth = Core.graphics.getWidth(); + } + }); } private void setupWidgets(){ @@ -268,14 +277,6 @@ public class FileChooser extends FloatingDialog{ return this; } - public void fileSelected(Consumer listener){ - this.selectListener = listener; - } - - public interface FileHandleFilter{ - boolean accept(FileHandle file); - } - public class FileHistory{ private Array history = new Array<>(); private int index; 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 2d1147f4af..f04e47cb4e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -78,7 +78,7 @@ public class MassDriver extends Block{ //reload regardless of state if(entity.reload > 0f){ - entity.reload = Mathf.clamp(entity.reload - entity.delta() / reloadTime); + entity.reload = Mathf.clamp(entity.reload - entity.delta() / reloadTime * entity.power.satisfaction); } //cleanup waiting shooters that are not valid @@ -114,7 +114,7 @@ public class MassDriver extends Block{ } //align to shooter rotation - entity.rotation = Mathf.slerpDelta(entity.rotation, tile.angleTo(entity.currentShooter()), rotateSpeed); + entity.rotation = Mathf.slerpDelta(entity.rotation, tile.angleTo(entity.currentShooter()), rotateSpeed * entity.power.satisfaction); }else if(entity.state == DriverState.shooting){ //if there's nothing to shoot at OR someone wants to shoot at this thing, bail if(!hasLink || !entity.waitingShooters.isEmpty()){ @@ -133,7 +133,7 @@ public class MassDriver extends Block{ other.waitingShooters.add(tile); //align to target location - entity.rotation = Mathf.slerpDelta(entity.rotation, targetRotation, rotateSpeed); + 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 &&