From 0db60202317ca4126d7bbce1d61add84fbc59457 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 14 Jul 2018 09:26:34 -0400 Subject: [PATCH] Increased bridge range / Bugfixes --- .../content/blocks/DistributionBlocks.java | 7 ++++--- .../content/blocks/LiquidBlocks.java | 6 +++--- .../io/anuke/mindustry/editor/MapEditor.java | 2 ++ .../mindustry/entities/units/FlyingUnit.java | 14 ++++++------- .../anuke/mindustry/game/ContentDatabase.java | 20 +++++-------------- .../mindustry/ui/dialogs/LevelDialog.java | 2 +- .../world/blocks/distribution/ItemBridge.java | 4 ++-- 7 files changed, 24 insertions(+), 31 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java index b5bbf1ad52..a0adfe48b5 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java @@ -27,12 +27,13 @@ public class DistributionBlocks extends BlockList implements ContentList{ }}; bridgeConveyor = new BufferedItemBridge("bridge-conveyor"){{ - range = 3; + range = 4; + speed = 60f; }}; phaseConveyor = new ItemBridge("phase-conveyor"){{ - range = 7; - hasPower = false; + range = 11; + hasPower = true; consumes.power(0.05f); }}; diff --git a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java index 8634381425..e824005518 100644 --- a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java @@ -58,13 +58,13 @@ public class LiquidBlocks extends BlockList implements ContentList{ liquidJunction = new LiquidJunction("liquid-junction"); bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{ - range = 3; + range = 4; hasPower = false; }}; phaseConduit = new LiquidBridge("phase-conduit"){{ - range = 7; - hasPower = false; + range = 11; + hasPower = true; consumes.power(0.05f); }}; } diff --git a/core/src/io/anuke/mindustry/editor/MapEditor.java b/core/src/io/anuke/mindustry/editor/MapEditor.java index 9d7c2fc44e..0f61541c3f 100644 --- a/core/src/io/anuke/mindustry/editor/MapEditor.java +++ b/core/src/io/anuke/mindustry/editor/MapEditor.java @@ -112,6 +112,8 @@ public class MapEditor{ boolean isfloor = drawBlock instanceof Floor && drawBlock != Blocks.air; if(drawBlock.isMultiblock()){ + x = Mathf.clamp(x, (drawBlock.size-1)/2, map.width() - drawBlock.size/2 - 1); + y = Mathf.clamp(y, (drawBlock.size-1)/2, map.height() - drawBlock.size/2 - 1); int offsetx = -(drawBlock.size - 1) / 2; int offsety = -(drawBlock.size - 1) / 2; diff --git a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java index 1b2df0d94c..b003e03984 100644 --- a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java @@ -23,10 +23,6 @@ import static io.anuke.mindustry.Vars.world; public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ protected static Translator vec = new Translator(); protected static float wobblyness = 0.6f; - - protected Trail trail = new Trail(8); - protected CarriableTrait carrying; - protected final UnitState resupply = new UnitState(){ @@ -44,6 +40,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ } } }, + idle = new UnitState(){ public void update(){ retarget(() -> { @@ -62,6 +59,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ velocity.scl(0.8f); } }, + attack = new UnitState(){ public void entered(){ target = null; @@ -88,7 +86,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ attack(150f); if((Mathf.angNear(angleTo(target), rotation, 15f) || !inventory.getAmmo().bullet.keepVelocity) //bombers don't care about rotation - && distanceTo(target) < inventory.getAmmo().getRange()){ + && distanceTo(target) < inventory.getAmmo().getRange()){ AmmoType ammo = inventory.getAmmo(); inventory.useAmmo(); @@ -117,6 +115,8 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ } } }; + protected Trail trail = new Trail(8); + protected CarriableTrait carrying; //instantiation only public FlyingUnit(){ @@ -149,7 +149,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ updateRotation(); trail.update(x + Angles.trnsx(rotation + 180f, 6f) + Mathf.range(wobblyness), - y + Angles.trnsy(rotation + 180f, 6f) + Mathf.range(wobblyness)); + y + Angles.trnsy(rotation + 180f, 6f) + Mathf.range(wobblyness)); wobble(); } @@ -173,7 +173,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{ @Override public void behavior(){ if(health <= health * type.retreatPercent && !isWave && - Geometry.findClosest(x, y, world.indexer().getAllied(team, BlockFlag.repair)) != null){ + Geometry.findClosest(x, y, world.indexer().getAllied(team, BlockFlag.repair)) != null){ setState(retreat); } diff --git a/core/src/io/anuke/mindustry/game/ContentDatabase.java b/core/src/io/anuke/mindustry/game/ContentDatabase.java index ed658e111f..64afe3e782 100644 --- a/core/src/io/anuke/mindustry/game/ContentDatabase.java +++ b/core/src/io/anuke/mindustry/game/ContentDatabase.java @@ -9,18 +9,12 @@ import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Settings; public class ContentDatabase{ - /** - * Maps unlockable type names to a set of unlocked content. - */ + /** Maps unlockable type names to a set of unlocked content.*/ private ObjectMap> unlocked = new ObjectMap<>(); - /** - * Whether unlockables have changed since the last save. - */ + /** Whether unlockables have changed since the last save.*/ private boolean dirty; - /** - * Returns whether or not this piece of content is unlocked yet. - */ + /** Returns whether or not this piece of content is unlocked yet.*/ public boolean isUnlocked(UnlockableContent content){ if(!unlocked.containsKey(content.getContentTypeName())){ unlocked.put(content.getContentTypeName(), new ObjectSet<>()); @@ -57,16 +51,12 @@ public class ContentDatabase{ return ret; } - /** - * Returns whether unlockables have changed since the last save. - */ + /** Returns whether unlockables have changed since the last save.*/ public boolean isDirty(){ return dirty; } - /** - * Clears all unlocked content. - */ + /** Clears all unlocked content.*/ public void reset(){ unlocked.clear(); dirty = true; diff --git a/core/src/io/anuke/mindustry/ui/dialogs/LevelDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/LevelDialog.java index 4df4316cd7..f5fbe37adb 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/LevelDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/LevelDialog.java @@ -153,7 +153,7 @@ public class LevelDialog extends FloatingDialog{ pane.setFadeScrollBars(false); table.row(); for(GameMode mode : GameMode.values()){ - table.labelWrap("[accent]" + mode.toString() + ":[] [lightgray]" + mode.description()).width(600f); + table.labelWrap("[accent]" + mode.toString() + ":[] [lightgray]" + mode.description()).width(400f); table.row(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java index da6c3f30d0..972c3b5eeb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java @@ -99,8 +99,8 @@ public class ItemBridge extends Block{ Lines.dashLine( x * tilesize + Geometry.d4[i].x * (tilesize / 2f + 2), y * tilesize + Geometry.d4[i].y * (tilesize / 2f + 2), - x * tilesize + Geometry.d4[i].x * range * tilesize, - y * tilesize + Geometry.d4[i].y * range * tilesize, + x * tilesize + Geometry.d4[i].x * (range + 0.5f) * tilesize, + y * tilesize + Geometry.d4[i].y * (range + 0.5f) * tilesize, range); }