diff --git a/core/assets-raw/sprites/blocks/distribution/overflowgate.png b/core/assets-raw/sprites/blocks/distribution/overflowgate.png new file mode 100644 index 0000000000..e67780b897 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/overflowgate.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index e1460a9506..e8b6a73599 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -186,72 +186,79 @@ multiplexer orig: 16, 16 offset: 0, 0 index: -1 -poweredconveyor +overflowgate rotate: false - xy: 543, 123 + xy: 553, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -poweredconveyormove +poweredconveyor rotate: false xy: 553, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -pulseconduit-bottom +poweredconveyormove rotate: false - xy: 563, 123 + xy: 563, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -pulseconduit-top +pulseconduit-bottom rotate: false xy: 503, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 +pulseconduit-top + rotate: false + xy: 513, 113 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 router rotate: false - xy: 573, 126 + xy: 573, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sortedunloader rotate: false - xy: 907, 405 + xy: 917, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sorter rotate: false - xy: 917, 405 + xy: 927, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 splitter rotate: false - xy: 776, 395 + xy: 776, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steelconveyor rotate: false - xy: 776, 385 + xy: 786, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steelconveyormove rotate: false - xy: 786, 395 + xy: 786, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -265,7 +272,7 @@ teleporter-top index: -1 unloader rotate: false - xy: 916, 385 + xy: 926, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -279,7 +286,7 @@ vault index: -1 vault-icon rotate: false - xy: 926, 395 + xy: 926, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -650,56 +657,56 @@ oiledge index: -1 rock1 rotate: false - xy: 576, 146 + xy: 573, 136 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rock2 rotate: false - xy: 573, 136 + xy: 573, 126 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand1 rotate: false - xy: 583, 136 + xy: 583, 126 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand2 rotate: false - xy: 583, 126 + xy: 583, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand3 rotate: false - xy: 583, 116 + xy: 596, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock1 rotate: false - xy: 596, 148 + xy: 606, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock2 rotate: false - xy: 606, 148 + xy: 616, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock3 rotate: false - xy: 616, 148 + xy: 626, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -713,56 +720,56 @@ sandedge index: -1 shrub rotate: false - xy: 797, 405 + xy: 807, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shrubshadow rotate: false - xy: 807, 405 + xy: 817, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow1 rotate: false - xy: 837, 405 + xy: 847, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow2 rotate: false - xy: 847, 405 + xy: 857, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow3 rotate: false - xy: 857, 405 + xy: 867, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock1 rotate: false - xy: 867, 405 + xy: 877, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock2 rotate: false - xy: 877, 405 + xy: 887, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock3 rotate: false - xy: 887, 405 + xy: 897, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -776,7 +783,7 @@ snowedge index: -1 space rotate: false - xy: 927, 405 + xy: 776, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -790,42 +797,42 @@ spaceedge index: -1 stone1 rotate: false - xy: 806, 385 + xy: 816, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stone2 rotate: false - xy: 816, 395 + xy: 816, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stone3 rotate: false - xy: 816, 385 + xy: 826, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock1 rotate: false - xy: 826, 395 + xy: 826, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock2 rotate: false - xy: 826, 385 + xy: 836, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock3 rotate: false - xy: 836, 395 + xy: 836, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -839,49 +846,49 @@ stoneedge index: -1 thorium1 rotate: false - xy: 856, 385 + xy: 866, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 thorium2 rotate: false - xy: 866, 395 + xy: 866, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 thorium3 rotate: false - xy: 866, 385 + xy: 876, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium1 rotate: false - xy: 876, 395 + xy: 876, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium2 rotate: false - xy: 876, 385 + xy: 886, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium3 rotate: false - xy: 886, 395 + xy: 886, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 water rotate: false - xy: 936, 395 + xy: 936, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -951,7 +958,7 @@ enemyspawn index: -1 playerspawn rotate: false - xy: 553, 143 + xy: 543, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1091,14 +1098,14 @@ nuclearreactor-lights index: -1 powerinfinite rotate: false - xy: 563, 143 + xy: 553, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 powernode rotate: false - xy: 553, 123 + xy: 563, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1112,28 +1119,28 @@ powernodelarge index: -1 powervoid rotate: false - xy: 563, 133 + xy: 563, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rtgenerator rotate: false - xy: 573, 116 + xy: 586, 146 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rtgenerator-top rotate: false - xy: 586, 146 + xy: 583, 136 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shieldgenerator rotate: false - xy: 646, 148 + xy: 656, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1147,7 +1154,7 @@ shieldprojector index: -1 solarpanel rotate: false - xy: 897, 405 + xy: 907, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1168,7 +1175,7 @@ teleporter-top index: -1 thermalgenerator rotate: false - xy: 856, 395 + xy: 856, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1525,63 +1532,63 @@ siliconsmelter-top index: -1 pulverizer rotate: false - xy: 513, 113 + xy: 523, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pulverizer-rotator rotate: false - xy: 523, 113 + xy: 533, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pump rotate: false - xy: 533, 113 + xy: 543, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill rotate: false - xy: 543, 113 + xy: 553, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill-rotator rotate: false - xy: 553, 113 + xy: 563, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill-top rotate: false - xy: 563, 113 + xy: 576, 146 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 separator rotate: false - xy: 626, 148 + xy: 636, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 separator-liquid rotate: false - xy: 636, 148 + xy: 646, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 siliconextractor rotate: false - xy: 817, 405 + xy: 827, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1595,56 +1602,56 @@ siliconsmelter index: -1 smelter rotate: false - xy: 827, 405 + xy: 837, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill rotate: false - xy: 786, 385 + xy: 796, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill-rotator rotate: false - xy: 796, 395 + xy: 796, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill-top rotate: false - xy: 796, 385 + xy: 806, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stonedrill rotate: false - xy: 836, 385 + xy: 846, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneformer rotate: false - xy: 846, 395 + xy: 846, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumdrill rotate: false - xy: 886, 385 + xy: 896, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumdrill-top rotate: false - xy: 896, 395 + xy: 896, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1973,7 +1980,7 @@ ironwall index: -1 steelwall rotate: false - xy: 806, 395 + xy: 806, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1987,21 +1994,21 @@ steelwall-large index: -1 stonewall rotate: false - xy: 846, 385 + xy: 856, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumshieldwall rotate: false - xy: 896, 385 + xy: 906, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumwall rotate: false - xy: 906, 395 + xy: 906, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -2085,7 +2092,7 @@ shell-back index: -1 shot rotate: false - xy: 787, 405 + xy: 797, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -3239,42 +3246,42 @@ clustergun-equip index: -1 shockgun rotate: false - xy: 656, 148 + xy: 777, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shockgun-equip rotate: false - xy: 777, 405 + xy: 787, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 triblaster rotate: false - xy: 906, 385 + xy: 916, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 triblaster-equip rotate: false - xy: 916, 395 + xy: 916, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 vulcan rotate: false - xy: 926, 385 + xy: 937, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 vulcan-equip rotate: false - xy: 937, 405 + xy: 936, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index c9720abdc7..a5294f4d71 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/assets/version.properties b/core/assets/version.properties index b2c2bb69f0..682c84954c 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,7 +1,7 @@ #Autogenerated file. Do not modify. -#Mon Apr 09 20:22:59 EDT 2018 +#Tue Apr 10 21:29:35 EDT 2018 version=release -androidBuildCode=896 +androidBuildCode=897 name=Mindustry code=3.5 build=custom build diff --git a/core/src/io/anuke/mindustry/content/Recipes.java b/core/src/io/anuke/mindustry/content/Recipes.java index df9bbdc808..31cf694aff 100644 --- a/core/src/io/anuke/mindustry/content/Recipes.java +++ b/core/src/io/anuke/mindustry/content/Recipes.java @@ -35,6 +35,7 @@ public class Recipes { new Recipe(distribution, DistributionBlocks.tunnel, stack(Items.iron, 2)), new Recipe(distribution, DistributionBlocks.sorter, stack(Items.steel, 2)), new Recipe(distribution, DistributionBlocks.splitter, stack(Items.steel, 1)), + new Recipe(distribution, DistributionBlocks.overflowgate, stack(Items.steel, 1)), new Recipe(distribution, StorageBlocks.vault, stack(Items.steel, 50)), new Recipe(distribution, StorageBlocks.core, stack(Items.steel, 50)), new Recipe(distribution, StorageBlocks.unloader, stack(Items.steel, 5)), diff --git a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java index 60c3788a75..87cbe182cf 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java @@ -44,5 +44,7 @@ public class DistributionBlocks{ sorter = new Sorter("sorter"), - splitter = new Splitter("splitter"); + splitter = new Splitter("splitter"), + + overflowgate = new OverflowGate("overflowgate"); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/ItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/ItemBridge.java index 32c5f8d11c..35a3754ccd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/ItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/ItemBridge.java @@ -21,8 +21,9 @@ import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.world; public class ItemBridge extends Block { - protected int timerTransport = timers++; + protected static int lastPlaced; + protected int timerTransport = timers++; protected int range; protected float powerUse = 0.05f; protected float transportTime = 2f; @@ -37,6 +38,15 @@ public class ItemBridge extends Block { itemCapacity = 30; } + @Override + public void placed(Tile tile) { + if(linkValid(tile, world.tile(lastPlaced))){ + ItemBridgeEntity entity = tile.entity(); + entity.link = lastPlaced; + } + lastPlaced = tile.packedPosition(); + } + @Override public boolean isConfigurable(Tile tile) { return true; @@ -111,9 +121,9 @@ public class ItemBridge extends Block { }else{ float use = Math.min(powerCapacity, powerUse * Timers.delta()); - if(entity.power.amount >= use){ + if(!hasPower || entity.power.amount >= use){ entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f); - entity.power.amount -= use; + if(hasPower) entity.power.amount -= use; }else{ entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f); } @@ -190,7 +200,7 @@ public class ItemBridge extends Block { return false; } - return other.block() instanceof ItemBridge && other.entity().link != tile.packedPosition(); + return other.block() == this && other.entity().link != tile.packedPosition(); } public static class ItemBridgeEntity extends TileEntity{ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/OverflowGate.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/OverflowGate.java new file mode 100644 index 0000000000..111b86de5c --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/OverflowGate.java @@ -0,0 +1,47 @@ +package io.anuke.mindustry.world.blocks.types.distribution; + +import io.anuke.mindustry.resource.Item; +import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.util.Mathf; + +public class OverflowGate extends Splitter { + + public OverflowGate(String name) { + super(name); + } + + @Override + Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){ + int dir = source.relativeTo(dest.x, dest.y); + if(dir == -1) return null; + Tile to = dest.getNearby(dir); + + if(!(to.block().acceptItem(item, to, dest) && + !(to.block().instantTransfer && source.block().instantTransfer))){ + Tile a = dest.getNearby(Mathf.mod(dir - 1, 4)); + Tile b = dest.getNearby(Mathf.mod(dir + 1, 4)); + boolean ac = !(a.block().instantTransfer && source.block().instantTransfer) && + a.block().acceptItem(item, a, dest); + boolean bc = !(b.block().instantTransfer && source.block().instantTransfer) && + b.block().acceptItem(item, b, dest); + + if(ac && !bc){ + to = a; + }else if(bc && !ac){ + to = b; + }else{ + if(dest.getDump() == 0){ + to = a; + if(flip) + dest.setDump((byte)1); + }else{ + to = b; + if(flip) + dest.setDump((byte)0); + } + } + } + + return to; + } +}