diff --git a/core/assets-raw/sprites/blocks/distribution/lightbridge-arrow.png b/core/assets-raw/sprites/blocks/distribution/itembridge-arrow.png similarity index 100% rename from core/assets-raw/sprites/blocks/distribution/lightbridge-arrow.png rename to core/assets-raw/sprites/blocks/distribution/itembridge-arrow.png diff --git a/core/assets-raw/sprites/blocks/distribution/lightbridge.png b/core/assets-raw/sprites/blocks/distribution/itembridge-bridge.png similarity index 100% rename from core/assets-raw/sprites/blocks/distribution/lightbridge.png rename to core/assets-raw/sprites/blocks/distribution/itembridge-bridge.png diff --git a/core/assets-raw/sprites/blocks/distribution/lightbridge-end.png b/core/assets-raw/sprites/blocks/distribution/itembridge-end.png similarity index 100% rename from core/assets-raw/sprites/blocks/distribution/lightbridge-end.png rename to core/assets-raw/sprites/blocks/distribution/itembridge-end.png diff --git a/core/assets-raw/sprites/blocks/distribution/liquidbridge-arrow.png b/core/assets-raw/sprites/blocks/distribution/liquidbridge-arrow.png new file mode 100644 index 0000000000..1a05e9052e Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/liquidbridge-arrow.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/liquidbridge-bridge.png b/core/assets-raw/sprites/blocks/distribution/liquidbridge-bridge.png new file mode 100644 index 0000000000..e6b4160901 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/liquidbridge-bridge.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/liquidbridge-end.png b/core/assets-raw/sprites/blocks/distribution/liquidbridge-end.png new file mode 100644 index 0000000000..37167be42a Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/liquidbridge-end.png differ diff --git a/core/assets-raw/sprites/blocks/distribution/liquidbridge.png b/core/assets-raw/sprites/blocks/distribution/liquidbridge.png new file mode 100644 index 0000000000..4e56d846e3 Binary files /dev/null and b/core/assets-raw/sprites/blocks/distribution/liquidbridge.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index bbde515cfe..e1460a9506 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -67,65 +67,93 @@ itembridge orig: 8, 8 offset: 0, 0 index: -1 -junction +itembridge-arrow + rotate: false + xy: 443, 114 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +itembridge-bridge + rotate: false + xy: 453, 124 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +itembridge-end rotate: false xy: 463, 134 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -lightbridge +junction rotate: false - xy: 463, 114 + xy: 463, 124 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -lightbridge-arrow +liquidbridge rotate: false - xy: 473, 124 + xy: 493, 144 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -lightbridge-end - rotate: false - xy: 483, 134 - size: 8, 8 - orig: 8, 8 - offset: 0, 0 - index: -1 -liquidjunction +liquidbridge-arrow rotate: false xy: 473, 114 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -liquidrouter +liquidbridge-bridge rotate: false xy: 483, 124 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -liquidrouter-bottom +liquidbridge-end rotate: false xy: 493, 134 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 +liquidjunction + rotate: false + xy: 493, 124 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +liquidrouter + rotate: false + xy: 493, 114 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +liquidrouter-bottom + rotate: false + xy: 503, 143 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 liquidrouter-liquid rotate: false - xy: 483, 114 + xy: 503, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 liquidrouter-top rotate: false - xy: 493, 124 + xy: 513, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -160,70 +188,70 @@ multiplexer index: -1 poweredconveyor rotate: false - xy: 543, 143 + xy: 543, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 poweredconveyormove rotate: false - xy: 533, 123 + xy: 553, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pulseconduit-bottom rotate: false - xy: 553, 133 + xy: 563, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pulseconduit-top rotate: false - xy: 563, 143 + xy: 503, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 router rotate: false - xy: 553, 113 + xy: 573, 126 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sortedunloader rotate: false - xy: 867, 405 + xy: 907, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sorter rotate: false - xy: 877, 405 + xy: 917, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 splitter rotate: false - xy: 897, 405 + xy: 776, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steelconveyor rotate: false - xy: 907, 405 + xy: 776, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steelconveyormove rotate: false - xy: 917, 405 + xy: 786, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -237,7 +265,7 @@ teleporter-top index: -1 unloader rotate: false - xy: 896, 385 + xy: 916, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -251,7 +279,7 @@ vault index: -1 vault-icon rotate: false - xy: 906, 395 + xy: 926, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -517,7 +545,7 @@ iron3 index: -1 lava rotate: false - xy: 473, 144 + xy: 473, 134 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -531,63 +559,63 @@ lavaedge index: -1 lead1 rotate: false - xy: 463, 124 + xy: 463, 114 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 lead2 rotate: false - xy: 473, 134 + xy: 473, 124 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 lead3 rotate: false - xy: 483, 144 + xy: 483, 134 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor1 rotate: false - xy: 503, 133 + xy: 523, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor2 rotate: false - xy: 513, 143 + xy: 513, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor3 rotate: false - xy: 503, 123 + xy: 523, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor4 rotate: false - xy: 513, 133 + xy: 533, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor5 rotate: false - xy: 523, 143 + xy: 523, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 metalfloor6 rotate: false - xy: 513, 123 + xy: 533, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -601,14 +629,14 @@ metalflooredge index: -1 mossblock rotate: false - xy: 523, 133 + xy: 543, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 oil rotate: false - xy: 533, 143 + xy: 533, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -622,56 +650,56 @@ oiledge index: -1 rock1 rotate: false - xy: 533, 113 + xy: 576, 146 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rock2 rotate: false - xy: 543, 113 + xy: 573, 136 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand1 rotate: false - xy: 573, 136 + xy: 583, 136 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand2 rotate: false - xy: 573, 126 + xy: 583, 126 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sand3 rotate: false - xy: 573, 116 + xy: 583, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock1 rotate: false - xy: 586, 146 + xy: 596, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock2 rotate: false - xy: 583, 136 + xy: 606, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 sandblock3 rotate: false - xy: 583, 126 + xy: 616, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -685,56 +713,56 @@ sandedge index: -1 shrub rotate: false - xy: 646, 148 + xy: 797, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shrubshadow rotate: false - xy: 656, 148 + xy: 807, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow1 rotate: false - xy: 797, 405 + xy: 837, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow2 rotate: false - xy: 807, 405 + xy: 847, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snow3 rotate: false - xy: 817, 405 + xy: 857, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock1 rotate: false - xy: 827, 405 + xy: 867, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock2 rotate: false - xy: 837, 405 + xy: 877, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 snowblock3 rotate: false - xy: 847, 405 + xy: 887, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -748,7 +776,7 @@ snowedge index: -1 space rotate: false - xy: 887, 405 + xy: 927, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -762,42 +790,42 @@ spaceedge index: -1 stone1 rotate: false - xy: 786, 385 + xy: 806, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stone2 rotate: false - xy: 796, 395 + xy: 816, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stone3 rotate: false - xy: 796, 385 + xy: 816, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock1 rotate: false - xy: 806, 395 + xy: 826, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock2 rotate: false - xy: 806, 385 + xy: 826, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneblock3 rotate: false - xy: 816, 395 + xy: 836, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -811,49 +839,49 @@ stoneedge index: -1 thorium1 rotate: false - xy: 836, 385 + xy: 856, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 thorium2 rotate: false - xy: 846, 395 + xy: 866, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 thorium3 rotate: false - xy: 846, 385 + xy: 866, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium1 rotate: false - xy: 856, 395 + xy: 876, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium2 rotate: false - xy: 856, 385 + xy: 876, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanium3 rotate: false - xy: 866, 395 + xy: 886, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 water rotate: false - xy: 916, 385 + xy: 936, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -923,7 +951,7 @@ enemyspawn index: -1 playerspawn rotate: false - xy: 533, 133 + xy: 553, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1035,7 +1063,7 @@ largesolarpanel index: -1 liquidcombustiongenerator rotate: false - xy: 493, 144 + xy: 483, 114 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1063,14 +1091,14 @@ nuclearreactor-lights index: -1 powerinfinite rotate: false - xy: 543, 133 + xy: 563, 143 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 powernode rotate: false - xy: 553, 143 + xy: 553, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1084,28 +1112,28 @@ powernodelarge index: -1 powervoid rotate: false - xy: 543, 123 + xy: 563, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rtgenerator rotate: false - xy: 563, 113 + xy: 573, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 rtgenerator-top rotate: false - xy: 576, 146 + xy: 586, 146 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shieldgenerator rotate: false - xy: 606, 148 + xy: 646, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1119,7 +1147,7 @@ shieldprojector index: -1 solarpanel rotate: false - xy: 857, 405 + xy: 897, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1140,7 +1168,7 @@ teleporter-top index: -1 thermalgenerator rotate: false - xy: 836, 395 + xy: 856, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1301,14 +1329,14 @@ irondrill-top index: -1 itemsource rotate: false - xy: 443, 114 + xy: 473, 144 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 itemvoid rotate: false - xy: 453, 124 + xy: 453, 114 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1336,21 +1364,21 @@ laserdrill-top index: -1 lavasmelter rotate: false - xy: 453, 114 + xy: 483, 144 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 liquidsource rotate: false - xy: 493, 114 + xy: 503, 123 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 melter rotate: false - xy: 503, 143 + xy: 513, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1413,7 +1441,7 @@ oilextractor-top index: -1 oilrefinery rotate: false - xy: 523, 123 + xy: 543, 133 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1497,63 +1525,63 @@ siliconsmelter-top index: -1 pulverizer rotate: false - xy: 553, 123 + xy: 513, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pulverizer-rotator rotate: false - xy: 563, 133 + xy: 523, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 pump rotate: false - xy: 563, 123 + xy: 533, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill rotate: false - xy: 503, 113 + xy: 543, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill-rotator rotate: false - xy: 513, 113 + xy: 553, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 reinforceddrill-top rotate: false - xy: 523, 113 + xy: 563, 113 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 separator rotate: false - xy: 583, 116 + xy: 626, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 separator-liquid rotate: false - xy: 596, 148 + xy: 636, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 siliconextractor rotate: false - xy: 777, 405 + xy: 817, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1567,56 +1595,56 @@ siliconsmelter index: -1 smelter rotate: false - xy: 787, 405 + xy: 827, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill rotate: false - xy: 927, 405 + xy: 786, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill-rotator rotate: false - xy: 776, 395 + xy: 796, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 steeldrill-top rotate: false - xy: 776, 385 + xy: 796, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stonedrill rotate: false - xy: 816, 385 + xy: 836, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 stoneformer rotate: false - xy: 826, 395 + xy: 846, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumdrill rotate: false - xy: 866, 385 + xy: 886, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumdrill-top rotate: false - xy: 876, 395 + xy: 896, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1945,7 +1973,7 @@ ironwall index: -1 steelwall rotate: false - xy: 786, 395 + xy: 806, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1959,21 +1987,21 @@ steelwall-large index: -1 stonewall rotate: false - xy: 826, 385 + xy: 846, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumshieldwall rotate: false - xy: 876, 385 + xy: 896, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titaniumwall rotate: false - xy: 886, 395 + xy: 906, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -2057,7 +2085,7 @@ shell-back index: -1 shot rotate: false - xy: 636, 148 + xy: 787, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -3211,42 +3239,42 @@ clustergun-equip index: -1 shockgun rotate: false - xy: 616, 148 + xy: 656, 148 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shockgun-equip rotate: false - xy: 626, 148 + xy: 777, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 triblaster rotate: false - xy: 886, 385 + xy: 906, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 triblaster-equip rotate: false - xy: 896, 395 + xy: 916, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 vulcan rotate: false - xy: 906, 385 + xy: 926, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 vulcan-equip rotate: false - xy: 916, 395 + xy: 937, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index f6c83e7c1d..c9720abdc7 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 85f79a50d7..6464636998 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,7 +1,7 @@ #Autogenerated file. Do not modify. -#Mon Apr 09 10:25:51 EDT 2018 +#Mon Apr 09 18:28:57 EDT 2018 version=release -androidBuildCode=891 +androidBuildCode=896 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 7f5597d92e..df9bbdc808 100644 --- a/core/src/io/anuke/mindustry/content/Recipes.java +++ b/core/src/io/anuke/mindustry/content/Recipes.java @@ -114,6 +114,7 @@ public class Recipes { new Recipe(liquid, LiquidBlocks.liquidtank, stack(Items.steel, 2)), new Recipe(liquid, LiquidBlocks.liquidjunction, stack(Items.steel, 2)), new Recipe(liquid, LiquidBlocks.conduittunnel, stack(Items.titanium, 2), stack(Items.steel, 2)), + new Recipe(liquid, LiquidBlocks.liquidbridge, stack(Items.titanium, 2), stack(Items.steel, 2)), new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)), new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)), diff --git a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java index 00de1d0102..764e9c7415 100644 --- a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java @@ -1,10 +1,7 @@ package io.anuke.mindustry.content.blocks; import io.anuke.mindustry.world.Block; -import io.anuke.mindustry.world.blocks.types.distribution.Conduit; -import io.anuke.mindustry.world.blocks.types.distribution.LiquidJunction; -import io.anuke.mindustry.world.blocks.types.distribution.LiquidRouter; -import io.anuke.mindustry.world.blocks.types.distribution.TunnelConduit; +import io.anuke.mindustry.world.blocks.types.distribution.*; import io.anuke.mindustry.world.blocks.types.production.Pump; public class LiquidBlocks { @@ -41,5 +38,9 @@ public class LiquidBlocks { conduittunnel = new TunnelConduit("conduittunnel") {{ speed = 53; + }}, + + liquidbridge = new LiquidBridge("liquidbridge"){{ + range = 7; }}; } diff --git a/core/src/io/anuke/mindustry/world/BaseBlock.java b/core/src/io/anuke/mindustry/world/BaseBlock.java index 41b508f5ec..d96524936b 100644 --- a/core/src/io/anuke/mindustry/world/BaseBlock.java +++ b/core/src/io/anuke/mindustry/world/BaseBlock.java @@ -81,8 +81,8 @@ public abstract class BaseBlock { } } - public void tryMoveLiquid(Tile tile, Tile next){ - if(next == null) return; + public float tryMoveLiquid(Tile tile, Tile next){ + if(next == null) return 0; next = next.target(); @@ -90,21 +90,23 @@ public abstract class BaseBlock { float ofract = next.entity.liquid.amount / next.block().liquidCapacity; float fract = tile.entity.liquid.amount / liquidCapacity; - if(ofract > fract) return; + if(ofract > fract) return 0; float flow = Math.min(Mathf.clamp((fract - ofract)*(1f)) * (liquidCapacity), tile.entity.liquid.amount); flow = Math.min(flow, next.block().liquidCapacity - next.entity.liquid.amount - 0.001f); - if(flow <= 0f) return; + if(flow <= 0f) return 0; float amount = flow; if(next.block().acceptLiquid(next, tile, tile.entity.liquid.liquid, amount)){ next.block().handleLiquid(next, tile, tile.entity.liquid.liquid, amount); tile.entity.liquid.amount -= amount; + return flow; } } + return 0; } /** diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conduit.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conduit.java index af5e20549d..bf795f065c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conduit.java @@ -1,10 +1,17 @@ package io.anuke.mindustry.world.blocks.types.distribution; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.LiquidBlock; +import io.anuke.mindustry.world.blocks.types.modules.LiquidModule; import io.anuke.ucore.graphics.Draw; +import io.anuke.ucore.util.Mathf; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; public class Conduit extends LiquidBlock { protected final int timerFlow = timers++; @@ -16,8 +23,28 @@ public class Conduit extends LiquidBlock { solid = false; } + @Override + public void draw(Tile tile){ + ConduitEntity entity = tile.entity(); + LiquidModule mod = tile.entity.liquid; + + int rotation = rotate ? tile.getRotation() * 90 : 0; + + Draw.rect(name() + "-bottom", tile.drawx(), tile.drawy(), rotation); + + Draw.color(mod.liquid.color); + Draw.alpha(entity.smoothLiquid); + Draw.rect(liquidRegion, tile.drawx(), tile.drawy(), rotation); + Draw.color(); + + Draw.rect(name() + "-top", tile.drawx(), tile.drawy(), rotation); + } + @Override public void update(Tile tile){ + ConduitEntity entity = tile.entity(); + entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquid.amount/liquidCapacity, 0.05f); + if(tile.entity.liquid.amount > 0.001f && tile.entity.timer.get(timerFlow, 1)){ tryMoveLiquid(tile, tile.getNearby(tile.getRotation())); } @@ -32,4 +59,23 @@ public class Conduit extends LiquidBlock { public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) { return super.acceptLiquid(tile, source, liquid, amount) && ((2 + source.relativeTo(tile.x, tile.y)) % 4 != tile.getRotation()); } + + @Override + public TileEntity getEntity() { + return new ConduitEntity(); + } + + public static class ConduitEntity extends TileEntity { + public float smoothLiquid; + + @Override + public void write(DataOutputStream stream) throws IOException { + stream.writeFloat(smoothLiquid); + } + + @Override + public void read(DataInputStream stream) throws IOException { + smoothLiquid = stream.readFloat(); + } + } } 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 4666fe32c0..32c5f8d11c 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 @@ -143,11 +143,11 @@ public class ItemBridge extends Block { Draw.color(Color.WHITE, Color.BLACK, Mathf.absin(Timers.time(), 6f, 0.07f)); Draw.alpha(Math.max(entity.uptime, 0.25f)); - Draw.rect("lightbridge-end", tile.drawx(), tile.drawy(), i*90 + 90); - Draw.rect("lightbridge-end", other.drawx(), other.drawy(), i*90 + 270); + Draw.rect(name + "-end", tile.drawx(), tile.drawy(), i*90 + 90); + Draw.rect(name + "-end", other.drawx(), other.drawy(), i*90 + 270); Lines.stroke(8f); - Lines.line(Draw.region("lightbridge"), + Lines.line(Draw.region(name + "-bridge"), tile.worldx(), tile.worldy(), other.worldx(), @@ -162,7 +162,7 @@ public class ItemBridge extends Block { for(int a = 0; a < arrows; a ++){ Draw.alpha(Mathf.absin(a/(float)arrows - entity.time/100f, 0.1f, 1f) * entity.uptime); - Draw.rect("lightbridge-arrow", + Draw.rect(name + "-arrow", tile.worldx() + Geometry.d4[i].x*(tilesize/2f + a*4f + time % 4f), tile.worldy() + Geometry.d4[i].y*(tilesize/2f + a*4f + time % 4f), i*90f); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidBridge.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidBridge.java new file mode 100644 index 0000000000..a8d1009ab4 --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidBridge.java @@ -0,0 +1,54 @@ +package io.anuke.mindustry.world.blocks.types.distribution; + +import io.anuke.mindustry.resource.Item; +import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Timers; +import io.anuke.ucore.util.Mathf; + +import static io.anuke.mindustry.Vars.world; + +public class LiquidBridge extends ItemBridge { + protected float transportSpeed = 0.5f; + + public LiquidBridge(String name) { + super(name); + hasInventory = false; + hasLiquids = true; + } + + @Override + public void update(Tile tile) { + ItemBridgeEntity entity = tile.entity(); + + entity.time += entity.cycleSpeed* Timers.delta(); + entity.time2 += (entity.cycleSpeed-1f)*Timers.delta(); + + Tile other = world.tile(entity.link); + if(!linkValid(tile, other)){ + tryDumpLiquid(tile); + }else{ + float use = Math.min(powerCapacity, powerUse * Timers.delta()); + + if(entity.power.amount >= use){ + entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f); + entity.power.amount -= use; + }else{ + entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f); + } + + if(entity.uptime >= 0.5f){ + + if(tryMoveLiquid(tile, other) > 0.1f){ + entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f); + }else{ + entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f); + } + } + } + } + + @Override + public boolean acceptItem(Item item, Tile tile, Tile source) { + return false; + } +}