diff --git a/core/assets-raw/sprites/blocks/sorter.png b/core/assets-raw/sprites/blocks/sorter.png new file mode 100644 index 0000000000..987efbc821 Binary files /dev/null and b/core/assets-raw/sprites/blocks/sorter.png differ diff --git a/core/assets-raw/sprites/blocks/teleporter-top.png b/core/assets-raw/sprites/blocks/teleporter-top.png new file mode 100644 index 0000000000..5e624107a8 Binary files /dev/null and b/core/assets-raw/sprites/blocks/teleporter-top.png differ diff --git a/core/assets-raw/sprites/blocks/teleporter.png b/core/assets-raw/sprites/blocks/teleporter.png new file mode 100644 index 0000000000..74f3d68a16 Binary files /dev/null and b/core/assets-raw/sprites/blocks/teleporter.png differ diff --git a/core/assets-raw/sprites/ui/icon-arrow-left.png b/core/assets-raw/sprites/ui/icon-arrow-left.png new file mode 100644 index 0000000000..ceac5c958a Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-arrow-left.png differ diff --git a/core/assets-raw/sprites/ui/icon-arrow-right.png b/core/assets-raw/sprites/ui/icon-arrow-right.png new file mode 100644 index 0000000000..23fd286809 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-arrow-right.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index 6bb78901e4..0be6b019a0 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -55,70 +55,70 @@ blocks/coaldrill index: -1 blocks/coalgenerator rotate: false - xy: 393, 192 + xy: 369, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalpurifier rotate: false - xy: 357, 180 + xy: 379, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/combustiongenerator rotate: false - xy: 367, 180 + xy: 389, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/compositewall rotate: false - xy: 377, 180 + xy: 399, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduit rotate: false - xy: 387, 180 + xy: 221, 20 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitbottom rotate: false - xy: 221, 20 + xy: 449, 408 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitliquid rotate: false - xy: 449, 408 + xy: 453, 418 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduittop rotate: false - xy: 453, 418 + xy: 449, 398 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyor rotate: false - xy: 449, 398 + xy: 447, 388 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyormove rotate: false - xy: 447, 388 + xy: 230, 62 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -132,49 +132,49 @@ blocks/core index: -1 blocks/cross rotate: false - xy: 230, 62 + xy: 230, 52 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/crucible rotate: false - xy: 230, 52 + xy: 403, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/deepwater rotate: false - xy: 403, 228 + xy: 459, 408 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt1 rotate: false - xy: 397, 182 + xy: 459, 398 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt2 rotate: false - xy: 459, 408 + xy: 457, 388 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt3 rotate: false - xy: 459, 398 + xy: 234, 122 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirtblock rotate: false - xy: 457, 388 + xy: 234, 112 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -195,14 +195,14 @@ blocks/doubleturret index: -1 blocks/drill rotate: false - xy: 234, 122 + xy: 234, 102 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/duriumwall rotate: false - xy: 234, 112 + xy: 234, 92 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -216,7 +216,7 @@ blocks/duriumwall-large index: -1 blocks/duriumwall-large-icon rotate: false - xy: 234, 102 + xy: 234, 82 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -230,35 +230,35 @@ blocks/flameturret index: -1 blocks/grass1 rotate: false - xy: 234, 82 + xy: 244, 127 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass2 rotate: false - xy: 234, 72 + xy: 244, 117 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass3 rotate: false - xy: 244, 127 + xy: 244, 107 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock rotate: false - xy: 244, 117 + xy: 244, 97 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock2 rotate: false - xy: 244, 107 + xy: 244, 87 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -272,56 +272,56 @@ blocks/grassedge index: -1 blocks/iron1 rotate: false - xy: 250, 57 + xy: 247, 37 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron2 rotate: false - xy: 250, 47 + xy: 237, 27 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron3 rotate: false - xy: 247, 37 + xy: 247, 27 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/irondrill rotate: false - xy: 237, 27 + xy: 257, 37 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ironwall rotate: false - xy: 247, 27 + xy: 257, 27 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/junction rotate: false - xy: 257, 37 + xy: 405, 362 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/laserturret rotate: false - xy: 225, 34 + xy: 389, 214 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/lava rotate: false - xy: 257, 27 + xy: 405, 352 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -335,49 +335,49 @@ blocks/lavaedge index: -1 blocks/liquidjunction rotate: false - xy: 405, 362 + xy: 405, 342 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidrouter rotate: false - xy: 405, 352 + xy: 405, 332 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/machineturret rotate: false - xy: 391, 226 + xy: 389, 202 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/megarepairturret rotate: false - xy: 389, 214 + xy: 333, 195 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mortarturret rotate: false - xy: 389, 202 + xy: 345, 195 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mossblock rotate: false - xy: 405, 332 + xy: 401, 312 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/mossstone rotate: false - xy: 405, 332 + xy: 401, 312 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -391,7 +391,7 @@ blocks/nuclearreactor index: -1 blocks/nuclearreactor-icon rotate: false - xy: 401, 312 + xy: 401, 292 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -405,7 +405,7 @@ blocks/nuclearreactor-small index: -1 blocks/oil rotate: false - xy: 401, 302 + xy: 411, 322 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -419,158 +419,165 @@ blocks/oiledge index: -1 blocks/oilrefinery rotate: false - xy: 401, 292 + xy: 411, 312 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/omnidrill rotate: false - xy: 411, 322 + xy: 411, 302 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/plasmaturret rotate: false - xy: 333, 195 + xy: 333, 183 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/powerbooster rotate: false - xy: 411, 302 + xy: 405, 282 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyor rotate: false - xy: 411, 292 + xy: 405, 272 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyormove rotate: false - xy: 405, 282 + xy: 405, 262 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaser rotate: false - xy: 405, 272 + xy: 415, 282 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaserrouter rotate: false - xy: 405, 262 + xy: 415, 272 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pump rotate: false - xy: 415, 282 + xy: 415, 262 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/repairturret rotate: false - xy: 345, 195 + xy: 345, 183 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/rock rotate: false - xy: 415, 262 + xy: 192, 2 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 193, 12 + xy: 453, 446 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2shadow rotate: false - xy: 192, 2 + xy: 401, 216 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow rotate: false - xy: 453, 446 + xy: 401, 206 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 401, 216 + xy: 369, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shadow rotate: false - xy: 333, 183 + xy: 357, 190 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shieldgenerator rotate: false - xy: 401, 206 + xy: 379, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shotgunturret rotate: false - xy: 345, 183 + xy: 369, 190 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shrub rotate: false - xy: 403, 196 + xy: 389, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shrubshadow rotate: false - xy: 221, 10 + xy: 399, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/smelter rotate: false - xy: 231, 17 + xy: 221, 10 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sniperturret rotate: false - xy: 357, 190 + xy: 381, 190 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 +blocks/sorter + rotate: false + xy: 231, 17 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 blocks/steelconveyor rotate: false xy: 241, 17 @@ -629,21 +636,21 @@ blocks/stoneblock index: -1 blocks/stoneblock2 rotate: false - xy: 397, 172 + xy: 467, 388 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock3 rotate: false - xy: 467, 388 + xy: 256, 129 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonedrill rotate: false - xy: 256, 129 + xy: 254, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -656,64 +663,78 @@ blocks/stoneedge offset: 0, 0 index: -1 blocks/stonewall - rotate: false - xy: 254, 119 - size: 8, 8 - orig: 8, 8 - offset: 0, 0 - index: -1 -blocks/thermalgenerator rotate: false xy: 254, 109 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -blocks/titanium1 +blocks/teleporter rotate: false xy: 254, 99 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -blocks/titanium2 +blocks/teleporter-top rotate: false xy: 254, 89 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -blocks/titanium3 +blocks/thermalgenerator rotate: false xy: 254, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 -blocks/titaniumdrill +blocks/titanium1 rotate: false xy: 254, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 +blocks/titanium2 + rotate: false + xy: 409, 378 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +blocks/titanium3 + rotate: false + xy: 419, 378 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +blocks/titaniumdrill + rotate: false + xy: 429, 380 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 blocks/titaniumpurifier rotate: false - xy: 407, 376 + xy: 415, 368 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 417, 378 + xy: 415, 358 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 427, 380 + xy: 415, 348 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -727,49 +748,49 @@ blocks/titaniumwall-large index: -1 blocks/titaniumwall-large-icon rotate: false - xy: 437, 380 + xy: 415, 338 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/turret rotate: false - xy: 369, 190 + xy: 393, 190 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/uranium1 rotate: false - xy: 457, 378 + xy: 425, 358 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 467, 378 + xy: 425, 348 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 407, 252 + xy: 425, 338 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 407, 242 + xy: 421, 328 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 417, 252 + xy: 421, 318 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -783,7 +804,7 @@ blocks/wateredge index: -1 blocks/waveturret rotate: false - xy: 381, 190 + xy: 357, 178 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -1035,49 +1056,49 @@ enemyarrow index: -1 icon-coal rotate: false - xy: 244, 97 + xy: 244, 77 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-dirium rotate: false - xy: 244, 87 + xy: 244, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-iron rotate: false - xy: 244, 77 + xy: 240, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-steel rotate: false - xy: 244, 67 + xy: 240, 47 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-stone rotate: false - xy: 240, 57 + xy: 237, 37 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-titanium rotate: false - xy: 240, 47 + xy: 250, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-uranium rotate: false - xy: 237, 37 + xy: 250, 47 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1098,7 +1119,7 @@ laserend index: -1 player rotate: false - xy: 411, 312 + xy: 411, 292 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1194,6 +1215,20 @@ ui/cursor orig: 4, 4 offset: 0, 0 index: -1 +ui/icon-arrow-left + rotate: false + xy: 393, 348 + size: 10, 10 + orig: 10, 10 + offset: 0, 0 + index: -1 +ui/icon-arrow-right + rotate: false + xy: 435, 390 + size: 10, 10 + orig: 10, 10 + offset: 0, 0 + index: -1 ui/icon-cancel rotate: false xy: 385, 318 @@ -1231,63 +1266,63 @@ ui/icon-close-over index: -1 ui/icon-crafting rotate: false - xy: 393, 348 + xy: 393, 336 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-cursor rotate: false - xy: 435, 390 + xy: 209, 18 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-defense rotate: false - xy: 393, 336 + xy: 244, 161 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-distribution rotate: false - xy: 209, 18 + xy: 244, 149 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-menu rotate: false - xy: 244, 161 + xy: 256, 163 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-pause rotate: false - xy: 244, 149 + xy: 256, 151 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-play rotate: false - xy: 256, 163 + xy: 244, 137 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-power rotate: false - xy: 256, 151 + xy: 256, 139 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-production rotate: false - xy: 244, 137 + xy: 443, 428 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -1308,21 +1343,21 @@ ui/icon-rotate-arrow index: -1 ui/icon-settings rotate: false - xy: 256, 139 + xy: 118, 6 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-touch rotate: false - xy: 443, 428 + xy: 225, 34 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-weapon rotate: false - xy: 118, 6 + xy: 391, 226 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -1472,35 +1507,35 @@ weapons/blaster index: -1 weapons/flamer rotate: false - xy: 234, 92 + xy: 234, 72 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/mortar rotate: false - xy: 405, 342 + xy: 401, 322 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/multigun rotate: false - xy: 401, 322 + xy: 401, 302 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/railgun rotate: false - xy: 415, 272 + xy: 193, 12 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 447, 378 + xy: 425, 368 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 56ea7839f3..818ec73de6 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index c1a8ef3f4d..db3b072d59 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -97,7 +97,16 @@ public class Control extends Module{ player = new Player(); spawns = Array.with( - + new EnemySpawn(TitanEnemy.class){{ + after = 16; + spacing = 3; + scaling = 5; + }}, + new EnemySpawn(HealerEnemy.class){{ + scaling = 3; + spacing = 2; + after = 8; + }}, new EnemySpawn(Enemy.class){{ scaling = 3; tierscaleback = 3; @@ -121,6 +130,11 @@ public class Control extends Module{ spacing = 3; scaling = 3; }}, + new EnemySpawn(EmpEnemy.class){{ + after = 19; + spacing = 3; + scaling = 5; + }}, new EnemySpawn(TankEnemy.class){{ after = 4; spacing = 2; @@ -132,6 +146,7 @@ public class Control extends Module{ scaling = 5; }} + ); } @@ -413,7 +428,6 @@ public class Control extends Module{ }else{ new TitanEnemy(0).set(player.x, player.y).add(); } - } } diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index 44713e17f3..7c43341414 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Interpolation; +import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Array; @@ -18,9 +19,13 @@ import io.anuke.mindustry.input.PlaceMode; import io.anuke.mindustry.resource.*; import io.anuke.mindustry.ui.*; import io.anuke.mindustry.world.Map; +import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.Blocks; +import io.anuke.mindustry.world.blocks.types.Configurable; import io.anuke.ucore.core.*; import io.anuke.ucore.function.VisibilityProvider; import io.anuke.ucore.modules.SceneModule; +import io.anuke.ucore.scene.Element; import io.anuke.ucore.scene.Skin; import io.anuke.ucore.scene.actions.Actions; import io.anuke.ucore.scene.builders.*; @@ -31,11 +36,12 @@ import io.anuke.ucore.scene.ui.layout.*; import io.anuke.ucore.util.Mathf; public class UI extends SceneModule{ - Table itemtable, weapontable, tools, loadingtable, desctable, respawntable; + Table itemtable, weapontable, tools, loadingtable, desctable, respawntable, configtable; SettingsDialog prefs; KeybindDialog keys; Dialog about, menu, restart, levels, upgrades, load, settingserror; Tooltip tooltip; + Tile configTile; VisibilityProvider play = () -> !GameState.is(State.menu); VisibilityProvider nplay = () -> GameState.is(State.menu); @@ -73,6 +79,7 @@ public class UI extends SceneModule{ Colors.put("turretinfo", Color.ORANGE); Colors.put("missingitems", Color.SCARLET); Colors.put("health", Color.YELLOW); + Colors.put("interact", Color.ORANGE); } protected void loadSkin(){ @@ -121,6 +128,9 @@ public class UI extends SceneModule{ @Override public void init(){ + configtable = new Table(); + scene.add(configtable); + settingserror = new Dialog("Warning", "dialog"); settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved."); settingserror.content().pad(10f); @@ -666,6 +676,32 @@ public class UI extends SceneModule{ }); } + public void showConfig(Tile tile){ + configTile = tile; + + configtable.setVisible(true); + configtable.clear(); + ((Configurable)tile.block()).buildTable(tile, configtable); + configtable.pack(); + + configtable.update(()->{ + Vector2 pos = Graphics.screen(tile.worldx(), tile.worldy()); + configtable.setPosition(pos.x, pos.y, Align.center); + if(configTile == null || configTile.block() == Blocks.air){ + hideConfig(); + } + }); + } + + public boolean hasConfigMouse(){ + Element e = scene.hit(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), true); + return e != null && (e == configtable || e.isDescendantOf(configtable)); + } + + public void hideConfig(){ + configtable.setVisible(false); + } + public void showError(String text){ new Dialog("[crimson]An error has occured", "dialog"){{ content().pad(Unit.dp.inPixels(15)); diff --git a/core/src/io/anuke/mindustry/entities/BulletType.java b/core/src/io/anuke/mindustry/entities/BulletType.java index d818016fce..19d9d73fdf 100644 --- a/core/src/io/anuke/mindustry/entities/BulletType.java +++ b/core/src/io/anuke/mindustry/entities/BulletType.java @@ -162,8 +162,16 @@ public abstract class BulletType extends BaseBulletType{ Draw.reset(); } }, + smallSlow = new BulletType(1.2f, 1){ + public void draw(Bullet b){ + Draw.color("orange"); + Draw.rect("bullet", b.x, b.y, b.angle()); + Draw.reset(); + } + }, purple = new BulletType(1.6f, 2){ Color color = new Color(0x8b5ec9ff); + public void draw(Bullet b){ Draw.color(color); Draw.rect("bullet", b.x, b.y, b.angle()); diff --git a/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java index 6a0e1cab55..5db42e6830 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/HealerEnemy.java @@ -12,14 +12,14 @@ import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.util.Angles; public class HealerEnemy extends Enemy{ - int healTime = 10; + int healTime = 14; public HealerEnemy(int spawn) { super(spawn); speed = 0.2f; reload = 30; - maxhealth = 210; + maxhealth = 130; range = 90f; bullet = BulletType.shot; range = 30f; diff --git a/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java index 75c43a8ac7..0558d950c5 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TankEnemy.java @@ -10,7 +10,7 @@ public class TankEnemy extends Enemy{ public TankEnemy(int spawn) { super(spawn); - maxhealth = 400; + maxhealth = 350; speed = 0.2f; reload = 90f; bullet = BulletType.small; diff --git a/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java index bfc4809a65..cc45391bd1 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/TitanEnemy.java @@ -12,7 +12,7 @@ public class TitanEnemy extends Enemy{ speed = 0.1f; reload = 30; - maxhealth = 210; + maxhealth = 330; range = 80f; bullet = BulletType.small; hitbox.setSize(7f); @@ -26,23 +26,23 @@ public class TitanEnemy extends Enemy{ @Override void updateShooting(){ - Timers.get(this, "salvo", 200); + Timers.get(this, "salvo", 250); if(Timers.getTime(this, "salvo") < 60){ - if(Timers.get(this, "salvoShoot", 5)){ + if(Timers.get(this, "salvoShoot", 6)){ shoot(BulletType.flame, Mathf.range(20f)); } } - if(Timers.get(this, "shotgun", 80)){ + if(Timers.get(this, "shotgun", 90)){ Angles.shotgun(5, 10f, 0f, f->{ - shoot(BulletType.small, f); + shoot(BulletType.smallSlow, f); }); } if(Timers.get(this, "circle", 200)){ Angles.circle(8, f->{ - shoot(BulletType.small, f); + shoot(BulletType.smallSlow, f); }); } } diff --git a/core/src/io/anuke/mindustry/input/Input.java b/core/src/io/anuke/mindustry/input/Input.java index ab176f7fbb..c05aa00d1f 100644 --- a/core/src/io/anuke/mindustry/input/Input.java +++ b/core/src/io/anuke/mindustry/input/Input.java @@ -11,6 +11,7 @@ import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.Weapon; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.World; +import io.anuke.mindustry.world.blocks.types.Configurable; import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Timers; @@ -45,6 +46,8 @@ public class Input{ } } + Tile cursor = World.tile(tilex(), tiley()); + if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null && World.validPlace(tilex(), tiley(), player.recipe.result) && !ui.hasMouse() && cursorNear() && Vars.control.hasItems(player.recipe.requirements)){ @@ -59,17 +62,25 @@ public class Input{ Cursors.restoreCursor(); } + }else if(Inputs.buttonUp(Buttons.LEFT)){ + if(cursor != null && cursor.block() instanceof Configurable){ + Vars.ui.showConfig(cursor); + }else if(!Vars.ui.hasConfigMouse()){ + Vars.ui.hideConfig(); + } + } + + if(Inputs.buttonUp(Buttons.RIGHT)){ + Vars.ui.hideConfig(); } if(player.recipe != null && Inputs.buttonUp(Buttons.RIGHT)){ player.recipe = null; Cursors.restoreCursor(); } - - Tile cursor = World.tile(tilex(), tiley()); //block breaking - if(cursor != null && Inputs.buttonDown(Buttons.RIGHT) && World.validBreak(tilex(), tiley())){ + if(Inputs.buttonDown(Buttons.RIGHT) && cursor != null && World.validBreak(tilex(), tiley())){ Tile tile = cursor; player.breaktime += Timers.delta(); if(player.breaktime >= tile.getBreakTime()){ diff --git a/core/src/io/anuke/mindustry/resource/Recipe.java b/core/src/io/anuke/mindustry/resource/Recipe.java index 2a58c9d955..991258ca8d 100644 --- a/core/src/io/anuke/mindustry/resource/Recipe.java +++ b/core/src/io/anuke/mindustry/resource/Recipe.java @@ -21,7 +21,6 @@ public enum Recipe{ titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)), shieldgenerator(defense, DefenseBlocks.shieldgenerator, stack(Item.titanium, 10), stack(Item.dirium, 10)), - conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)), steelconveyor(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)), poweredconveyor(distribution, DistributionBlocks.poweredconveyor, stack(Item.dirium, 1)), @@ -30,6 +29,7 @@ public enum Recipe{ conduit(distribution, DistributionBlocks.conduit, stack(Item.steel, 1)), liquidrouter(distribution, DistributionBlocks.liquidrouter, stack(Item.steel, 2)), liquidjunction(distribution, DistributionBlocks.liquidjunction, stack(Item.steel, 2)), + sorter(distribution, DistributionBlocks.sorter, stack(Item.steel, 2)), turret(weapon, WeaponBlocks.turret, stack(Item.stone, 4)), dturret(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)), @@ -62,6 +62,7 @@ public enum Recipe{ powerbooster(power, DistributionBlocks.powerbooster, stack(Item.titanium, 10), stack(Item.dirium, 10)), powerlaser(power, DistributionBlocks.powerlaser, stack(Item.titanium, 10), stack(Item.dirium, 10)), powerlaserrouter(power, DistributionBlocks.powerlaserrouter, stack(Item.titanium, 10), stack(Item.dirium, 10)), + teleporter(power, DistributionBlocks.teleporter, stack(Item.titanium, 10), stack(Item.dirium, 10)), pump(production, ProductionBlocks.pump, stack(Item.steel, 10)); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 90f574f4d8..e6462f26b9 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -69,7 +69,7 @@ public class Block{ return amount; } - public void handleItem(Tile tile, Item item, Tile source){ + public void handleItem(Item item, Tile tile, Tile source){ tile.entity.addItem(item, 1); } @@ -107,7 +107,7 @@ public class Block{ //don't output to things facing this thing && !(other.block().rotate && (other.rotation + 2) % 4 == i)){ - other.block().handleItem(other, item, tile); + other.block().handleItem(item, other, tile); tile.dump = (byte)((i+1)%4); return; } @@ -115,7 +115,7 @@ public class Block{ i %= 4; } tile.dump = (byte)pdump; - handleItem(tile, item, tile); + handleItem(item, tile, tile); } /** Try dumping any item near the tile. */ @@ -142,7 +142,7 @@ public class Block{ if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, tile) && //don't output to things facing this thing !(other.block().rotate && (other.rotation + 2) % 4 == i)){ - other.block().handleItem(other, item, tile); + other.block().handleItem(item, other, tile); tile.entity.removeItem(item, 1); tile.dump = (byte)((i+1)%4); return true; @@ -161,7 +161,7 @@ public class Block{ protected boolean offloadDir(Tile tile, Item item){ Tile other = tile.getNearby()[tile.rotation]; if(other != null && other.block().acceptItem(item, other, tile)){ - other.block().handleItem(other, item, tile); + other.block().handleItem(item, other, tile); //other.entity.addCovey(item, ch == 1 ? 0.5f : ch ==2 ? 1f : 0f); return true; } diff --git a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java index 7899c72bc7..53e9b09d6e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/DistributionBlocks.java @@ -56,5 +56,15 @@ public class DistributionBlocks{ { formalName = "laser router"; } + }, + teleporter = new Teleporter("teleporter"){ + { + + } + }, + sorter = new Sorter("sorter"){ + { + + } }; } diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index 2f23b060c9..aae24ec36d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -27,7 +27,7 @@ public class ProductionBlocks{ } @Override - public void handleItem(Tile tile, Item item, Tile source){ + public void handleItem(Item item, Tile tile, Tile source){ Vars.control.addItem(item, 1); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java b/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java index aca3e6cf66..866d0a10c8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/BlockPart.java @@ -21,8 +21,8 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{ } @Override - public void handleItem(Tile tile, Item item, Tile source){ - tile.getLinked().block().handleItem(tile.getLinked(), item, source); + public void handleItem(Item item, Tile tile, Tile source){ + tile.getLinked().block().handleItem(item, tile.getLinked(), source); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/Configurable.java b/core/src/io/anuke/mindustry/world/blocks/types/Configurable.java new file mode 100644 index 0000000000..b59ad48f1e --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/types/Configurable.java @@ -0,0 +1,8 @@ +package io.anuke.mindustry.world.blocks.types; + +import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.scene.ui.layout.Table; + +public interface Configurable{ + public void buildTable(Tile tile, Table table); +} diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java index f13cf8c6d8..8d7f9bb51d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java @@ -108,7 +108,7 @@ public class Conveyor extends Block{ } @Override - public void handleItem(Tile tile, Item item, Tile source){ + public void handleItem(Item item, Tile tile, Tile source){ int ch = Math.abs(source.relativeTo(tile.x, tile.y) - tile.rotation); int ang = ((source.relativeTo(tile.x, tile.y) - tile.rotation)); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java index c1450b3ed6..d41f91673b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Junction.java @@ -19,14 +19,13 @@ public class Junction extends Block{ } @Override - public void handleItem(Tile tile, Item item, Tile source){ + public void handleItem(Item item, Tile tile, Tile source){ int dir = source.relativeTo(tile.x, tile.y); - dir = (dir+4)%4; Tile to = tile.getNearby()[dir]; Timers.run(15, ()->{ if(to == null || to.entity == null) return; - to.block().handleItem(to, item, tile); + to.block().handleItem(item, to, tile); }); } @@ -34,10 +33,8 @@ public class Junction extends Block{ @Override public boolean acceptItem(Item item, Tile dest, Tile source){ int dir = source.relativeTo(dest.x, dest.y); - dir = (dir+4)%4; Tile to = dest.getNearby()[dir]; - //uncomment the junction bit to disable giving items to other junctions - return to != null /*&& to.block() != junction*/ && to.block().acceptItem(item, to, dest); + return to != null && to.block().acceptItem(item, to, dest); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java index 41a5aba0d5..e8b0306dcf 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Router.java @@ -36,8 +36,8 @@ public class Router extends Block{ } @Override - public void handleItem(Tile tile, Item item, Tile source){ - super.handleItem(tile, item, source); + public void handleItem(Item item, Tile tile, Tile source){ + super.handleItem(item, tile, source); lastmap.put(tile, (byte)tile.relativeTo(source.x, source.y)); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Sorter.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Sorter.java index 7e10391c7e..2208be4cb3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Sorter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Sorter.java @@ -4,20 +4,119 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import com.badlogic.gdx.graphics.g2d.TextureRegion; + import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.types.Configurable; +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Timers; +import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.scene.ui.layout.Unit; +import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Tmp; //TODO -public class Sorter extends Junction{ +public class Sorter extends Junction implements Configurable{ public Sorter(String name) { super(name); } - public boolean acceptItem(Item item, Tile tile, Tile source){ + @Override + public void draw(Tile tile){ + super.draw(tile); + SorterEntity entity = tile.entity(); - return super.acceptItem(item, tile, source) && item == entity.sortItem; + + TextureRegion region = Draw.region("icon-" + entity.sortItem.name()); + Tmp.tr1.setRegion(region, 4, 4, 1, 1); + + Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 4f, 4f); + } + + @Override + public String description(){ + return "[interact]Tap block to config[]\nSorts input items by type."; + } + + @Override + public boolean acceptItem(Item item, Tile dest, Tile source){ + Tile to = getTileTarget(item, dest, source, false); + + return to != null && to.block().acceptItem(item, to, dest); + } + + @Override + public void handleItem(Item item, Tile tile, Tile source){ + Tile to = getTileTarget(item, tile, source, true); + + Timers.run(15, ()->{ + if(to == null || to.entity == null) return; + to.block().handleItem(item, to, tile); + }); + + } + + Tile getTileTarget(Item item, Tile dest, Tile source, boolean flip){ + SorterEntity entity = dest.entity(); + + int dir = source.relativeTo(dest.x, dest.y); + Tile to = null; + + if(item == entity.sortItem){ + to = dest.getNearby()[dir]; + }else{ + Tile a = dest.getNearby()[Mathf.mod(dir - 1, 4)]; + Tile b = dest.getNearby()[Mathf.mod(dir + 1, 4)]; + boolean ac = a.block().acceptItem(item, a, dest); + boolean bc = b.block().acceptItem(item, b, dest); + + if(ac && !bc){ + to = a; + }else if(bc && !ac){ + to = b; + }else{ + if(dest.dump == 0){ + to = a; + if(flip) + dest.dump = 1; + }else{ + to = b; + if(flip) + dest.dump = 0; + } + } + } + + return to; + } + + @Override + public void buildTable(Tile tile, Table table){ + SorterEntity entity = tile.entity(); + + table.addIButton("icon-arrow-left", Unit.dp.inPixels(10*3), ()->{ + int color = entity.sortItem.ordinal(); + + color --; + if(color < 0) + color += Item.values().length; + + entity.sortItem = Item.values()[color]; + }); + + table.add().size(40f).units(Unit.dp); + + table.addIButton("icon-arrow-right", Unit.dp.inPixels(10*3), ()->{ + int color = entity.sortItem.ordinal(); + + color ++; + color %= Item.values().length; + + entity.sortItem = Item.values()[color]; + }); } @Override @@ -26,7 +125,7 @@ public class Sorter extends Junction{ } public static class SorterEntity extends TileEntity{ - public Item sortItem = Item.stone; + public Item sortItem = Item.iron; @Override public void write(DataOutputStream stream) throws IOException{ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Teleporter.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Teleporter.java index 563eeac9a1..56a04d3ba4 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Teleporter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Teleporter.java @@ -4,21 +4,135 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.ObjectSet; + import io.anuke.mindustry.entities.TileEntity; +import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; +import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.types.Configurable; +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Timers; +import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.scene.ui.layout.Unit; +import io.anuke.ucore.util.Mathf; //TODO -public class Teleporter extends Block{ +public class Teleporter extends Block implements Configurable{ public static final int colors = 4; + public static final Color[] colorArray = {Color.ROYAL, Color.ORANGE, Color.SCARLET, Color.FOREST}; + + private static Array removal = new Array<>(); + private static Array returns = new Array<>(); + private static ObjectSet[] teleporters = new ObjectSet[colors]; + + static{ + for(int i = 0; i < colors; i ++){ + teleporters[i] = new ObjectSet<>(); + } + } public Teleporter(String name) { super(name); + update = true; + solid = true; + } + + @Override + public String description(){ + return "[interact]Tap block to config[]\nTeleports items to others of the same color."; + } + + @Override + public void draw(Tile tile){ + TeleporterEntity entity = tile.entity(); + + super.draw(tile); + + Draw.color(colorArray[entity.color]); + Draw.rect("blank", tile.worldx(), tile.worldy(), 2, 2); + Draw.color(Color.WHITE); + Draw.alpha(0.45f + Mathf.absin(Timers.time(), 7f, 0.26f)); + Draw.rect("teleporter-top", tile.worldx(), tile.worldy()); + Draw.reset(); + } + + @Override + public void update(Tile tile){ + TeleporterEntity entity = tile.entity(); + + teleporters[entity.color].add(tile); + + if(entity.totalItems() > 0){ + tryDump(tile); + } + } + + @Override + public void buildTable(Tile tile, Table table){ + TeleporterEntity entity = tile.entity(); + + table.addIButton("icon-arrow-left", Unit.dp.inPixels(10*3), ()->{ + entity.color --; + if(entity.color < 0) + entity.color += 4; + }); + + table.add().size(40f).units(Unit.dp); + + table.addIButton("icon-arrow-right", Unit.dp.inPixels(10*3), ()->{ + entity.color ++; + entity.color %= 4; + }); + } + + @Override + public void handleItem(Item item, Tile tile, Tile source){ + Array links = findLinks(tile); + + if(links.size > 0){ + Tile target = links.get(Mathf.random(0, links.size-1)); + target.entity.addItem(item, 1); + } + } + + @Override + public boolean acceptItem(Item item, Tile dest, Tile source){ + Array links = findLinks(dest); + return links.size > 0; } @Override public TileEntity getEntity(){ return new TeleporterEntity(); } + + static Array findLinks(Tile tile){ + TeleporterEntity entity = tile.entity(); + + removal.clear(); + returns.clear(); + + for(Tile other : teleporters[entity.color]){ + if(other != tile){ + if(other.block() instanceof Teleporter){ + if(other.entity().color != entity.color){ + removal.add(other); + }else if(other.entity.totalItems() == 0){ + returns.add(other); + } + }else{ + removal.add(other); + } + } + } + for(Tile remove : removal) + teleporters[entity.color].remove(remove); + + return returns; + } public static class TeleporterEntity extends TileEntity{ public byte color = 0; @@ -33,4 +147,5 @@ public class Teleporter extends Block{ color = stream.readByte(); } } + } diff --git a/desktop/mindustry-saves/0.mins b/desktop/mindustry-saves/0.mins index 3a418ca6bc..216c23b406 100644 Binary files a/desktop/mindustry-saves/0.mins and b/desktop/mindustry-saves/0.mins differ