diff --git a/build.gradle b/build.gradle index b8acbbda5e..3433cb161f 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.anuken:ucore:283ecacfef' + compile 'com.github.anuken:ucore:9c523c4' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/assets-raw/sprites/ui/icon-fill.png b/core/assets-raw/sprites/ui/icon-fill.png new file mode 100755 index 0000000000..027b395162 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-fill.png differ diff --git a/core/assets-raw/sprites/ui/icon-loading.png b/core/assets-raw/sprites/ui/icon-loading.png new file mode 100644 index 0000000000..d53ace4c51 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-loading.png differ diff --git a/core/assets-raw/sprites/ui/icon-pencil.png b/core/assets-raw/sprites/ui/icon-pencil.png new file mode 100755 index 0000000000..a36d4d5fa4 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-pencil.png differ diff --git a/core/assets-raw/sprites/ui/icon-pick.png b/core/assets-raw/sprites/ui/icon-pick.png new file mode 100755 index 0000000000..05090f51a5 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-pick.png differ diff --git a/core/assets-raw/sprites/ui/icon-redo.png b/core/assets-raw/sprites/ui/icon-redo.png new file mode 100755 index 0000000000..0a0291301a Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-redo.png differ diff --git a/core/assets-raw/sprites/ui/icon-undo.png b/core/assets-raw/sprites/ui/icon-undo.png new file mode 100755 index 0000000000..b56d258984 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-undo.png differ diff --git a/core/assets-raw/sprites/ui/icon-zoom.png b/core/assets-raw/sprites/ui/icon-zoom.png new file mode 100755 index 0000000000..7a882ceb06 Binary files /dev/null and b/core/assets-raw/sprites/ui/icon-zoom.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index cd2882139d..621a57163f 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -20,70 +20,70 @@ blank index: -1 blocks/blackrock1 rotate: false - xy: 349, 79 + xy: 349, 91 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackrockshadow1 rotate: false - xy: 361, 91 + xy: 370, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone1 rotate: false - xy: 229, 67 + xy: 349, 81 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone2 rotate: false - xy: 239, 67 + xy: 359, 91 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone3 rotate: false - xy: 249, 67 + xy: 380, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock1 rotate: false - xy: 259, 67 + xy: 359, 81 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock2 rotate: false - xy: 269, 67 + xy: 390, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock3 rotate: false - xy: 279, 67 + xy: 400, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneedge rotate: false - xy: 178, 94 + xy: 1011, 499 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/block rotate: false - xy: 299, 67 + xy: 420, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -111,119 +111,119 @@ blocks/chainturret index: -1 blocks/chainturret-icon rotate: false - xy: 558, 177 + xy: 648, 284 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/coal1 rotate: false - xy: 319, 67 + xy: 440, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal2 rotate: false - xy: 329, 67 + xy: 450, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal3 rotate: false - xy: 339, 67 + xy: 460, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coaldrill rotate: false - xy: 349, 69 + xy: 470, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalgenerator rotate: false - xy: 370, 103 + xy: 229, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalgenerator-top rotate: false - xy: 380, 105 + xy: 239, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalpurifier rotate: false - xy: 390, 105 + xy: 249, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/combustiongenerator rotate: false - xy: 400, 105 + xy: 259, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/compositewall rotate: false - xy: 410, 105 + xy: 269, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduit rotate: false - xy: 420, 105 + xy: 279, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitbottom rotate: false - xy: 430, 105 + xy: 289, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitliquid rotate: false - xy: 440, 105 + xy: 299, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduittop rotate: false - xy: 450, 105 + xy: 309, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyor rotate: false - xy: 460, 105 + xy: 319, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyormove rotate: false - xy: 470, 105 + xy: 329, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyortunnel rotate: false - xy: 480, 105 + xy: 339, 67 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -237,56 +237,56 @@ blocks/core index: -1 blocks/cross rotate: false - xy: 371, 93 + xy: 349, 71 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/crucible rotate: false - xy: 381, 95 + xy: 359, 71 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/deepwater rotate: false - xy: 391, 95 + xy: 575, 167 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt1 rotate: false - xy: 401, 95 + xy: 575, 157 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt2 rotate: false - xy: 411, 95 + xy: 575, 147 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt3 rotate: false - xy: 421, 95 + xy: 660, 268 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirtedge rotate: false - xy: 529, 147 + xy: 178, 94 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/door rotate: false - xy: 431, 95 + xy: 670, 268 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -300,7 +300,7 @@ blocks/door-large index: -1 blocks/door-large-icon rotate: false - xy: 441, 95 + xy: 680, 268 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -314,21 +314,21 @@ blocks/door-large-open index: -1 blocks/door-open rotate: false - xy: 451, 95 + xy: 480, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/doubleturret rotate: false - xy: 582, 177 + xy: 558, 177 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/duriumwall rotate: false - xy: 461, 95 + xy: 490, 105 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -342,259 +342,259 @@ blocks/duriumwall-large index: -1 blocks/duriumwall-large-icon rotate: false - xy: 471, 95 + xy: 225, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/flameturret rotate: false - xy: 226, 101 + xy: 570, 177 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/fluxpump rotate: false - xy: 225, 57 + xy: 245, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass1 rotate: false - xy: 235, 57 + xy: 255, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass2 rotate: false - xy: 245, 57 + xy: 265, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass3 rotate: false - xy: 255, 57 + xy: 275, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock1 rotate: false - xy: 265, 57 + xy: 285, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock2 rotate: false - xy: 275, 57 + xy: 295, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassedge rotate: false - xy: 211, 55 + xy: 630, 266 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/ice1 rotate: false - xy: 285, 57 + xy: 305, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice2 rotate: false - xy: 295, 57 + xy: 315, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice3 rotate: false - xy: 305, 57 + xy: 325, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iceedge rotate: false - xy: 563, 189 + xy: 600, 250 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/icerock1 rotate: false - xy: 315, 57 + xy: 335, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerock2 rotate: false - xy: 325, 57 + xy: 502, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow1 rotate: false - xy: 335, 57 + xy: 512, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow1 rotate: false - xy: 335, 57 + xy: 512, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow2 rotate: false - xy: 495, 126 + xy: 805, 446 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow2 rotate: false - xy: 495, 126 + xy: 805, 446 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron1 rotate: false - xy: 510, 116 + xy: 151, 44 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron2 rotate: false - xy: 510, 106 + xy: 161, 58 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron3 rotate: false - xy: 491, 96 + xy: 171, 58 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/irondrill rotate: false - xy: 501, 96 + xy: 161, 48 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ironwall rotate: false - xy: 511, 96 + xy: 171, 48 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/junction rotate: false - xy: 525, 127 + xy: 181, 52 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/laserturret rotate: false - xy: 322, 101 + xy: 301, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/lava rotate: false - xy: 520, 116 + xy: 580, 199 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/lavaedge rotate: false - xy: 559, 163 + xy: 197, 55 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/lavasmelter rotate: false - xy: 520, 106 + xy: 580, 189 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquiditemjunction rotate: false - xy: 521, 96 + xy: 582, 179 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidjunction rotate: false - xy: 151, 54 + xy: 590, 199 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidrouter rotate: false - xy: 151, 44 + xy: 590, 189 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/machineturret rotate: false - xy: 301, 77 + xy: 322, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/megarepairturret rotate: false - xy: 313, 89 + xy: 301, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mortarturret rotate: false - xy: 334, 101 + xy: 313, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mossblock rotate: false - xy: 171, 58 + xy: 585, 169 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/mossstone rotate: false - xy: 171, 58 + xy: 585, 169 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -615,7 +615,7 @@ blocks/nuclearreactor-center index: -1 blocks/nuclearreactor-icon rotate: false - xy: 171, 48 + xy: 585, 149 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -629,231 +629,231 @@ blocks/nuclearreactor-lights index: -1 blocks/nuclearreactor-small rotate: false - xy: 270, 113 + xy: 396, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/oil rotate: false - xy: 181, 52 + xy: 595, 169 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/oiledge rotate: false - xy: 577, 189 + xy: 660, 278 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/oilrefinery rotate: false - xy: 345, 57 + xy: 595, 159 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/omnidrill rotate: false - xy: 539, 137 + xy: 595, 149 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/plasmaturret rotate: false - xy: 313, 77 + xy: 334, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/powerbooster rotate: false - xy: 535, 127 + xy: 349, 61 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyor rotate: false - xy: 530, 117 + xy: 359, 61 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyormove rotate: false - xy: 530, 107 + xy: 561, 139 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaser rotate: false - xy: 531, 97 + xy: 802, 376 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlasercorner rotate: false - xy: 540, 117 + xy: 161, 38 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaserrouter rotate: false - xy: 540, 107 + xy: 171, 38 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduit rotate: false - xy: 545, 127 + xy: 181, 42 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduitbottom rotate: false - xy: 541, 97 + xy: 157, 28 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduittop rotate: false - xy: 550, 117 + xy: 167, 28 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pump rotate: false - xy: 550, 107 + xy: 157, 18 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/repairturret rotate: false - xy: 325, 89 + xy: 313, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/rock1 rotate: false - xy: 161, 38 + xy: 191, 45 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 171, 38 + xy: 201, 45 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 181, 42 + xy: 211, 45 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rtgenerator rotate: false - xy: 157, 28 + xy: 571, 137 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rtgenerator-top rotate: false - xy: 167, 28 + xy: 521, 132 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand1 rotate: false - xy: 191, 45 + xy: 518, 122 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand2 rotate: false - xy: 201, 45 + xy: 531, 135 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand3 rotate: false - xy: 211, 45 + xy: 541, 135 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock1 rotate: false - xy: 181, 32 + xy: 551, 135 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock2 rotate: false - xy: 191, 35 + xy: 561, 129 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock3 rotate: false - xy: 201, 35 + xy: 571, 127 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandedge rotate: false - xy: 587, 163 + xy: 674, 278 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/shadow rotate: false - xy: 346, 101 + xy: 325, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shieldgenerator rotate: false - xy: 159, 18 + xy: 191, 35 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shotgunturret rotate: false - xy: 325, 77 + xy: 346, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shrub rotate: false - xy: 169, 8 + xy: 177, 22 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -874,7 +874,7 @@ blocks/smelter index: -1 blocks/sniperturret rotate: false - xy: 337, 89 + xy: 325, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -923,7 +923,7 @@ blocks/snowblock3 index: -1 blocks/snowedge rotate: false - xy: 117, 8 + xy: 563, 189 size: 12, 12 orig: 12, 12 offset: 0, 0 @@ -958,7 +958,7 @@ blocks/steelwall index: -1 blocks/steelwall-large rotate: false - xy: 288, 113 + xy: 414, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -1021,7 +1021,7 @@ blocks/stonedrill index: -1 blocks/stoneedge rotate: false - xy: 131, 8 + xy: 561, 163 size: 12, 12 orig: 12, 12 offset: 0, 0 @@ -1056,7 +1056,7 @@ blocks/teleporter-top index: -1 blocks/thermalgenerator rotate: false - xy: 341, 47 + xy: 581, 137 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1070,133 +1070,133 @@ blocks/titancannon index: -1 blocks/titancannon-icon rotate: false - xy: 358, 101 + xy: 337, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/titanium1 rotate: false - xy: 341, 37 + xy: 581, 127 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium2 rotate: false - xy: 351, 47 + xy: 591, 139 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium3 rotate: false - xy: 351, 37 + xy: 591, 129 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumdrill rotate: false - xy: 802, 420 + xy: 522, 112 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumpurifier rotate: false - xy: 802, 410 + xy: 528, 122 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 802, 400 + xy: 538, 125 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 802, 390 + xy: 548, 125 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall-large rotate: false - xy: 360, 113 + xy: 881, 495 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/titaniumwall-large-icon rotate: false - xy: 802, 380 + xy: 532, 112 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/turret rotate: false - xy: 337, 77 + xy: 358, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/uranium1 rotate: false - xy: 211, 25 + xy: 177, 12 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 221, 25 + xy: 187, 22 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 231, 27 + xy: 187, 12 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 241, 27 + xy: 197, 25 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 251, 27 + xy: 197, 15 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/wateredge rotate: false - xy: 145, 8 + xy: 561, 149 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/waveturret rotate: false - xy: 349, 89 + xy: 337, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 bullet rotate: false - xy: 309, 67 + xy: 430, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1224,112 +1224,112 @@ circle2 index: -1 enemies/blastenemy-t1 rotate: false - xy: 378, 115 + xy: 899, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/blastenemy-t2 rotate: false - xy: 394, 115 + xy: 915, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/blastenemy-t3 rotate: false - xy: 410, 115 + xy: 931, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t1 rotate: false - xy: 426, 115 + xy: 947, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t2 rotate: false - xy: 442, 115 + xy: 963, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t3 rotate: false - xy: 458, 115 + xy: 979, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/enemy-t1 rotate: false - xy: 474, 115 + xy: 995, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/targetenemy-t1 rotate: false - xy: 474, 115 + xy: 995, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/enemy-t2 rotate: false - xy: 545, 163 + xy: 1011, 485 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 enemies/enemy-t3 rotate: false - xy: 197, 55 + xy: 616, 266 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 enemies/fastenemy-t1 rotate: false - xy: 881, 497 + xy: 563, 203 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/fastenemy-t2 rotate: false - xy: 897, 497 + xy: 715, 293 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/fastenemy-t3 rotate: false - xy: 913, 497 + xy: 722, 406 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t1 rotate: false - xy: 929, 497 + xy: 722, 390 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t2 rotate: false - xy: 945, 497 + xy: 738, 406 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t3 rotate: false - xy: 961, 497 + xy: 738, 390 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -1357,105 +1357,105 @@ enemies/fortressenemy-t3 index: -1 enemies/healerenemy-t1 rotate: false - xy: 977, 497 + xy: 754, 406 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/healerenemy-t2 rotate: false - xy: 993, 497 + xy: 754, 390 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/healerenemy-t3 rotate: false - xy: 1009, 497 + xy: 181, 78 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t1 rotate: false - xy: 197, 69 + xy: 786, 382 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t2 rotate: false - xy: 213, 85 + xy: 529, 161 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t3 rotate: false - xy: 213, 69 + xy: 529, 145 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t1 rotate: false - xy: 125, 22 + xy: 545, 161 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t2 rotate: false - xy: 141, 22 + xy: 545, 145 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t3 rotate: false - xy: 786, 414 + xy: 600, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t1 rotate: false - xy: 786, 398 + xy: 616, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t2 rotate: false - xy: 786, 382 + xy: 600, 264 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t3 rotate: false - xy: 529, 161 + xy: 632, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/titanenemy-t1 rotate: false - xy: 306, 113 + xy: 432, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 enemies/titanenemy-t2 rotate: false - xy: 324, 113 + xy: 450, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 enemies/titanenemy-t3 rotate: false - xy: 342, 113 + xy: 468, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -1469,56 +1469,56 @@ enemyarrow index: -1 icon-coal rotate: false - xy: 505, 126 + xy: 805, 436 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-dirium rotate: false - xy: 515, 126 + xy: 805, 426 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-iron rotate: false - xy: 529, 137 + xy: 802, 416 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-steel rotate: false - xy: 490, 116 + xy: 802, 406 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-stone rotate: false - xy: 490, 106 + xy: 802, 396 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-titanium rotate: false - xy: 500, 116 + xy: 802, 386 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-uranium rotate: false - xy: 500, 106 + xy: 151, 54 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 laser rotate: false - xy: 805, 442 + xy: 577, 189 size: 1, 12 orig: 1, 12 offset: 0, 0 @@ -1539,35 +1539,35 @@ laserfull index: -1 mechs/mech-standard rotate: false - xy: 573, 163 + xy: 211, 55 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 shell rotate: false - xy: 211, 35 + xy: 181, 32 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot rotate: false - xy: 159, 8 + xy: 201, 35 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot-long rotate: false - xy: 169, 18 + xy: 211, 35 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanshell rotate: false - xy: 191, 25 + xy: 542, 115 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1659,56 +1659,56 @@ ui/check-over index: -1 ui/clear rotate: false - xy: 570, 177 + xy: 648, 272 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/cursor rotate: false - xy: 579, 203 + xy: 592, 245 size: 4, 4 orig: 4, 4 offset: 0, 0 index: -1 ui/icon-areaDelete rotate: false - xy: 238, 101 + xy: 226, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-arrow rotate: false - xy: 563, 203 + xy: 579, 209 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-arrow-left rotate: false - xy: 229, 89 + xy: 238, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-arrow-right rotate: false - xy: 250, 101 + xy: 229, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-cancel rotate: false - xy: 715, 293 + xy: 181, 62 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-check rotate: false - xy: 722, 406 + xy: 486, 115 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -1736,214 +1736,263 @@ ui/icon-close-over index: -1 ui/icon-crafting rotate: false - xy: 229, 77 + xy: 250, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-cursor rotate: false - xy: 241, 89 + xy: 229, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-defense rotate: false - xy: 262, 101 + xy: 241, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-discord rotate: false - xy: 722, 390 + xy: 502, 120 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-distribution rotate: false - xy: 241, 77 + xy: 262, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-donate rotate: false - xy: 738, 406 + xy: 770, 406 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 +ui/icon-fill + rotate: false + xy: 270, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 ui/icon-hold rotate: false - xy: 253, 89 + xy: 241, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-holdDelete rotate: false - xy: 274, 101 + xy: 253, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-info rotate: false - xy: 253, 77 + xy: 274, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-load rotate: false - xy: 738, 390 + xy: 770, 390 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 +ui/icon-loading + rotate: false + xy: 288, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 ui/icon-menu rotate: false - xy: 265, 89 + xy: 253, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-none rotate: false - xy: 286, 101 + xy: 265, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-pause rotate: false - xy: 265, 77 + xy: 286, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 +ui/icon-pencil + rotate: false + xy: 306, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 +ui/icon-pick + rotate: false + xy: 324, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 ui/icon-play rotate: false - xy: 277, 89 + xy: 265, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-play-2 rotate: false - xy: 754, 406 + xy: 194, 101 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-power rotate: false - xy: 298, 101 + xy: 277, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-production rotate: false - xy: 277, 77 + xy: 298, 101 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-quit - rotate: false - xy: 754, 390 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-rotate - rotate: false - xy: 181, 78 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-rotate-arrow - rotate: false - xy: 579, 209 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-rotate-left - rotate: false - xy: 181, 62 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-rotate-right - rotate: false - xy: 770, 406 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-save - rotate: false - xy: 770, 390 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-settings - rotate: false - xy: 289, 89 - size: 10, 10 - orig: 10, 10 - offset: 0, 0 - index: -1 -ui/icon-terrain - rotate: false - xy: 194, 101 - size: 14, 14 - orig: 14, 14 - offset: 0, 0 - index: -1 -ui/icon-tools rotate: false xy: 210, 101 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 -ui/icon-touch +ui/icon-redo rotate: false - xy: 310, 101 - size: 10, 10 - orig: 10, 10 + xy: 342, 113 + size: 16, 16 + orig: 16, 16 offset: 0, 0 index: -1 -ui/icon-touchDelete - rotate: false - xy: 289, 77 - size: 10, 10 - orig: 10, 10 - offset: 0, 0 - index: -1 -ui/icon-tutorial +ui/icon-rotate rotate: false xy: 197, 85 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 -ui/icon-weapon +ui/icon-rotate-arrow rotate: false - xy: 301, 89 + xy: 197, 69 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-rotate-left + rotate: false + xy: 213, 85 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-rotate-right + rotate: false + xy: 213, 69 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-save + rotate: false + xy: 125, 22 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-settings + rotate: false + xy: 277, 77 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 +ui/icon-terrain + rotate: false + xy: 141, 22 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-tools + rotate: false + xy: 786, 414 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-touch + rotate: false + xy: 289, 89 + size: 10, 10 + orig: 10, 10 + offset: 0, 0 + index: -1 +ui/icon-touchDelete + rotate: false + xy: 310, 101 + size: 10, 10 + orig: 10, 10 + offset: 0, 0 + index: -1 +ui/icon-tutorial + rotate: false + xy: 786, 398 + size: 14, 14 + orig: 14, 14 + offset: 0, 0 + index: -1 +ui/icon-undo + rotate: false + xy: 360, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 +ui/icon-weapon + rotate: false + xy: 289, 77 + size: 10, 10 + orig: 10, 10 + offset: 0, 0 + index: -1 +ui/icon-zoom + rotate: false + xy: 378, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 ui/logotext rotate: false xy: 1, 85 @@ -2024,7 +2073,7 @@ ui/separator index: -1 ui/slider rotate: false - xy: 177, 28 + xy: 558, 125 size: 1, 8 orig: 1, 8 offset: 0, 0 @@ -2161,42 +2210,42 @@ ui/window-empty index: -1 weapons/blaster rotate: false - xy: 289, 67 + xy: 410, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/flamer rotate: false - xy: 481, 95 + xy: 235, 57 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/mortar rotate: false - xy: 161, 58 + xy: 592, 179 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/multigun rotate: false - xy: 161, 48 + xy: 585, 159 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/railgun rotate: false - xy: 551, 97 + xy: 167, 18 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 201, 25 + xy: 552, 115 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 7790dd39e3..3a2d6eb16f 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/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 4cebf9df83..9a77033ec6 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -16,8 +16,8 @@ import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.*; import io.anuke.mindustry.entities.effect.Fx; import io.anuke.mindustry.entities.effect.Shield; -import io.anuke.mindustry.entities.enemies.BlastEnemy; import io.anuke.mindustry.entities.enemies.Enemy; +import io.anuke.mindustry.entities.enemies.FortressEnemy; import io.anuke.mindustry.entities.enemies.HealerEnemy; import io.anuke.mindustry.input.AndroidInput; import io.anuke.mindustry.input.DesktopInput; @@ -471,7 +471,7 @@ public class Control extends Module{ new HealerEnemy().set(player.x, player.y).add(); }else{ float px = player.x, py = player.y; - Timers.run(30f, ()-> new BlastEnemy().set(px, py).add()); + Timers.run(30f, ()-> new FortressEnemy().set(px, py).add()); } } } diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 5f377bc492..3d56a9483d 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -546,7 +546,7 @@ public class Renderer extends RendererModule{ Draw.dashCircle(spawn.start.worldx(), spawn.start.worldy(), enemyspawnspace); } - }else if(player.breakMode.delete && control.input.drawPlace()){ + }else if(player.breakMode.delete && control.input.drawPlace() && player.recipe == null){ //TODO test! player.breakMode.draw(control.input.getBlockX(), control.input.getBlockY(), control.input.getBlockEndX(), control.input.getBlockEndY()); } diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 04f47ce952..b8260a5b62 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -448,6 +448,14 @@ public class UI extends SceneModule{ public void showEditor(){ editorDialog.show(); } + + public MapEditorDialog getEditor(){ + return editorDialog; + } + + public boolean isEditing(){ + return editorDialog.getScene() != null; + } public void updateItems(){ ((HudFragment)hudfrag).updateItems(); diff --git a/core/src/io/anuke/mindustry/editor/Editor.java b/core/src/io/anuke/mindustry/editor/Editor.java deleted file mode 100644 index fcf5f2c713..0000000000 --- a/core/src/io/anuke/mindustry/editor/Editor.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.anuke.mindustry.editor; - -import io.anuke.ucore.modules.ModuleCore; - -public class Editor extends ModuleCore{ - public static EditorControl control; - public static EditorUI ui; - - @Override - public void init(){ - module(control = new EditorControl()); - module(ui = new EditorUI()); - } - -} diff --git a/core/src/io/anuke/mindustry/editor/EditorControl.java b/core/src/io/anuke/mindustry/editor/EditorControl.java deleted file mode 100644 index 7635e88e41..0000000000 --- a/core/src/io/anuke/mindustry/editor/EditorControl.java +++ /dev/null @@ -1,267 +0,0 @@ -package io.anuke.mindustry.editor; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input.Keys; -import com.badlogic.gdx.files.FileHandle; -import com.badlogic.gdx.graphics.Pixmap; -import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.math.Vector2; -import com.badlogic.gdx.utils.*; -import com.badlogic.gdx.utils.reflect.ClassReflection; - -import io.anuke.mindustry.world.Block; -import io.anuke.mindustry.world.Generator; -import io.anuke.mindustry.world.blocks.Blocks; -import io.anuke.mindustry.world.blocks.types.Floor; -import io.anuke.ucore.core.Core; -import io.anuke.ucore.core.Inputs; -import io.anuke.ucore.graphics.Pixmaps; -import io.anuke.ucore.modules.Module; -import io.anuke.ucore.noise.RidgedPerlin; -import io.anuke.ucore.noise.Simplex; -import io.anuke.ucore.util.Mathf; - -public class EditorControl extends Module{ - private ObjectIntMap colors = new ObjectIntMap<>(); - Pixmap pixmap; - Texture texture; - Simplex sim = new Simplex(); - RidgedPerlin rid = new RidgedPerlin(1, 10, 20f); - RidgedPerlin rid2 = new RidgedPerlin(1, 6, 1f); - RidgedPerlin rid3 = new RidgedPerlin(1, 6, 1f); - String map = "fortress"; - ObjectMap prefs = new OrderedMap(){ - { - put("replace", true); - put("terrain", false); - put("circle", false); - put("distort", false); - put("sand", false); - put("grass", false); - put("stone", false); - put("allgrass", false); - put("allsnow", false); - put("allsand", false); - put("lavarock", false); - put("water", false); - put("oil", false); - put("lavariver", false); - put("slavariver", false); - put("river", false); - put("iceriver", false); - put("oilriver", false); - } - }; - - public EditorControl() { - IntMap.Keys keys = Generator.colors.keys(); - - for(int key = keys.next(); keys.hasNext; key = keys.next()){ - colors.put(Generator.colors.get(key), key); - } - loadMap(map); - } - - @Override - public void update(){ - clearScreen(); - - if(Inputs.keyUp(Keys.ESCAPE)){ - Gdx.app.exit(); - } - - if(Core.scene.getKeyboardFocus() == null){ - if(Inputs.keyUp(Keys.R)){ - randomize(); - loadMap(map); - } - - if(Inputs.keyUp(Keys.E)){ - try{ - ClassReflection.getMethod(ClassReflection.forName("com.badlogic.gdx.graphics.PixmapIO"), "writePNG", FileHandle.class, Pixmap.class) - .invoke(Gdx.files.absolute("/home/anuke/Pictures/maps/out-" + TimeUtils.millis() + ".png"), pixmap); - }catch (Exception e){ - throw new RuntimeException(e); - } - } - } - } - - public void randomize(){ - sim.setSeed(Mathf.random(999999)); - rid.setSeed(Mathf.random(999999)); - rid2.setSeed(Mathf.random(999999)); - rid3.setSeed(Mathf.random(999999)); - } - - public void reload(){ - loadMap(map); - } - - public void loadMap(String name){ - if(pixmap != null) - pixmap.dispose(); - pixmap = new Pixmap(Gdx.files.internal("maps/" + name + ".png")); - process(); - } - - public void process(){ - if(prefs.get("terrain")){ - for(int x = 0; x < pixmap.getWidth(); x++){ - for(int y = 0; y < pixmap.getHeight(); y++){ - float dist = Vector2.dst((float) x / pixmap.getWidth(), (float) y / pixmap.getHeight(), 0.5f, 0.5f) * 2f; - double noise = sim.octaveNoise2D(6, 0.6, 1 / 180.0, x, y + 9999) / (prefs.get("circle") ? 1.7 : 1f) + dist / 10f; - - if(dist > 0.8){ - noise += 2 * (dist - 0.8); - } - - Block block = noise > 0.6 ? Blocks.stoneblock : Blocks.stone; - - pixmap.drawPixel(x, y, colors.get(block, 0)); - } - } - } - - Pixmap src = Pixmaps.copy(pixmap); - - for(int x = 0; x < pixmap.getWidth(); x++){ - for(int y = 0; y < pixmap.getHeight(); y++){ - int dx = 0, dy = 0; - - if(prefs.get("distort")){ - double intensity = 12; - double scale = 80; - double octaves = 4; - double falloff = 0.6; - double nx = (sim.octaveNoise2D(octaves, falloff, 1 / scale, x, y) - 0.5f) * intensity; - double ny = (sim.octaveNoise2D(octaves, falloff, 1 / scale, x, y + 99999) - 0.5f) * intensity; - dx = (int) nx; - dy = (int) ny; - } - - int pix = src.getPixel(x + dx, y + dy); - - Block block = Generator.colors.get(pix); - - if(block == null) - continue; - - boolean floor = block instanceof Floor; - - double noise = sim.octaveNoise2D(4, 0.6, 1 / 170.0, x, y) + sim.octaveNoise2D(1, 1.0, 1 / 5.0, x, y) / 18.0; - double nwater = sim.octaveNoise2D(1, 1.0, 1 / 130.0, x, y); - noise += nwater / 5.0; - - double noil = sim.octaveNoise2D(1, 1.0, 1 / 150.0, x + 9999, y) + sim.octaveNoise2D(1, 1.0, 1 / 2.0, x, y) / 290.0; - - if(!floor || prefs.get("replace")){ - - if(prefs.get("allgrass")){ - block = floor ? Blocks.grass : Blocks.grassblock; - }else if(prefs.get("allsnow")){ - block = floor ? Blocks.snow : Blocks.snowblock; - }else if(prefs.get("allsand")){ - block = floor ? Blocks.sand : Blocks.sandblock; - }else if(prefs.get("replace")){ - block = floor ? Blocks.stone : Blocks.stoneblock; - } - - if(noise > 0.7 && prefs.get("grass")){ - block = floor ? Blocks.grass : Blocks.grassblock; - } - if(noise > 0.7 && prefs.get("lavarock")){ - block = floor ? Blocks.blackstone : Blocks.blackstoneblock; - } - if(noise > 0.7 && prefs.get("sand")){ - block = floor ? Blocks.sand : Blocks.sandblock; - } - if(noise > 0.8 && prefs.get("stone")){ - block = floor ? Blocks.stone : Blocks.stoneblock; - } - } - - if(floor){ - if(nwater > 0.93 && prefs.get("water")){ - block = Blocks.water; - if(nwater > 0.943){ - block = Blocks.deepwater; - } - } - - if(noil > 0.95 && prefs.get("oil")){ - block = Blocks.dirt; - if(noil > 0.955){ - block = Blocks.oil; - } - } - } - - if(floor && prefs.get("lavariver")){ - double lava = rid.getValue(x, y, 1 / 100f); - double t = 0.6; - if(lava > t){ - block = Blocks.lava; - }else if(lava > t - 0.2){ - block = Blocks.blackstone; - } - } - - if(floor && prefs.get("slavariver")){ - double lava = rid.getValue(x, y, 1 / 40f); - double t = 0.7; - if(lava > t){ - block = Blocks.lava; - }else if(lava > t - 0.3){ - block = Blocks.blackstone; - } - } - - if(floor && prefs.get("oilriver")){ - double lava = rid3.getValue(x, y, 1 / 100f); - double t = 0.9; - if(lava > t){ - block = Blocks.oil; - }else if(lava > t - 0.2){ - block = Blocks.dirt; - } - } - - if(floor && prefs.get("river")){ - double riv = rid2.getValue(x, y, 1 / 140f); - double t = 0.4; - - if(riv > t + 0.1){ - block = Blocks.deepwater; - }else if(riv > t){ - block = Blocks.water; - }else if(riv > t - 0.2){ - block = Blocks.grass; - } - } - - if(floor && prefs.get("iceriver")){ - double riv = rid2.getValue(x, y, 1 / 140f); - double t = 0.4; - - if(riv > t + 0.1){ - block = Blocks.ice; - }else if(riv > t){ - block = Blocks.ice; - }else if(riv > t - 0.2){ - block = Blocks.snow; - } - } - - pixmap.drawPixel(x, y, colors.get(block, 0)); - } - } - - src.dispose(); - - if(texture != null){ - texture.dispose(); - } - texture = new Texture(pixmap); - } -} diff --git a/core/src/io/anuke/mindustry/editor/EditorUI.java b/core/src/io/anuke/mindustry/editor/EditorUI.java deleted file mode 100644 index 497d866fb4..0000000000 --- a/core/src/io/anuke/mindustry/editor/EditorUI.java +++ /dev/null @@ -1,65 +0,0 @@ -package io.anuke.mindustry.editor; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input.Buttons; -import com.badlogic.gdx.graphics.g2d.TextureRegion; -import com.badlogic.gdx.utils.Scaling; - -import io.anuke.ucore.core.Graphics; -import io.anuke.ucore.core.Inputs; -import io.anuke.ucore.graphics.Atlas; -import io.anuke.ucore.modules.SceneModule; -import io.anuke.ucore.scene.Skin; -import io.anuke.ucore.scene.builders.*; -import io.anuke.ucore.scene.style.TextureRegionDrawable; -import io.anuke.ucore.scene.ui.Image; -import io.anuke.ucore.scene.ui.TextField; - -public class EditorUI extends SceneModule{ - - @Override - public void init(){ - - build.begin(); - new table(){{ - Image image = new Image(); - image.update(()-> image.setDrawable(new TextureRegionDrawable(new TextureRegion(Editor.control.texture)))); - image.setScaling(Scaling.fit); - add(image).size(256 * 3); - - new table("button"){{ - new field(Editor.control.map, text->{ - if(Gdx.files.internal("maps/" + text + ".png").exists()){ - Editor.control.map = text; - Editor.control.reload(); - } - }); - row(); - for(String key : Editor.control.prefs.keys()){ - new checkbox(key, Editor.control.prefs.get(key), b->{ - Editor.control.prefs.put(key, b); - Editor.control.reload(); - }).left(); - row(); - } - margin(16); - }}.end(); - }}.end(); - build.end(); - } - - @Override - public void update(){ - super.update(); - if(Inputs.buttonUp(Buttons.LEFT)){ - if(!hasMouse() || !(scene.hit(Graphics.mouse().x, Graphics.mouse().y, true) instanceof TextField)){ - scene.setKeyboardFocus(null); - } - } - } - - @Override - protected void loadSkin(){ - skin = new Skin(Gdx.files.internal("ui/uiskin.json"), new Atlas(Gdx.files.internal("sprites/sprites.atlas"))); - } -} diff --git a/core/src/io/anuke/mindustry/entities/EnemySpawn.java b/core/src/io/anuke/mindustry/entities/EnemySpawn.java index 6ecabd473f..a09be71f51 100644 --- a/core/src/io/anuke/mindustry/entities/EnemySpawn.java +++ b/core/src/io/anuke/mindustry/entities/EnemySpawn.java @@ -1,9 +1,12 @@ package io.anuke.mindustry.entities; import io.anuke.mindustry.entities.enemies.Enemy; +import io.anuke.ucore.core.Settings; import io.anuke.ucore.util.Mathf; public class EnemySpawn{ + private static float[] scalings = {2f, 1.5f, 1f}; + /**The enemy type spawned*/ public final Class type; /**When this spawns should end*/ @@ -33,6 +36,8 @@ public class EnemySpawn{ if(wave < after || wave > before || (wave - after) % spacing != 0){ return 0; } + float scaling = this.scaling * scalings[(Settings.getInt("difficulty"))]; + return Math.min(amount-1 + 1 * Math.max((int)((wave / spacing) / scaling), 1) - (tier(wave, lane)-1) * tierscaleback, max); } diff --git a/core/src/io/anuke/mindustry/entities/effect/Fx.java b/core/src/io/anuke/mindustry/entities/effect/Fx.java index 6ef2a659ca..bb8a9b48f3 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fx.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fx.java @@ -331,6 +331,15 @@ public class Fx{ Draw.reset(); }), + shieldhit = new Effect(9, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.SKY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 6); + Draw.thickness(4f*e.fract()); + Draw.circle(e.x, e.y, e.ifract()*14f); + Draw.reset(); + }), + shoot = new Effect(8, e -> { Draw.thickness(1f); Draw.color(Color.WHITE, Color.GOLD, e.ifract()); diff --git a/core/src/io/anuke/mindustry/input/AndroidInput.java b/core/src/io/anuke/mindustry/input/AndroidInput.java index 8b08291165..fb5185d0f8 100644 --- a/core/src/io/anuke/mindustry/input/AndroidInput.java +++ b/core/src/io/anuke/mindustry/input/AndroidInput.java @@ -78,7 +78,7 @@ public class AndroidInput extends InputHandler{ if(!GameState.is(State.menu)){ Tile cursor = world.tile(Mathf.scl2(Graphics.mouseWorld().x, tilesize), Mathf.scl2(Graphics.mouseWorld().y, tilesize)); - if(cursor != null && !ui.hasMouse()){ + if(cursor != null && !ui.hasMouse(screenX, screenY)){ Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor; if(linked != null && linked.block() instanceof Configurable){ ui.showConfig(linked); @@ -155,7 +155,7 @@ public class AndroidInput extends InputHandler{ } @Override - public void tryPlaceBlock(int x, int y, boolean sound){ + public boolean tryPlaceBlock(int x, int y, boolean sound){ if(player.recipe != null && validPlace(x, y, player.recipe.result) && cursorNear() && Vars.control.hasItems(player.recipe.requirements)){ @@ -169,6 +169,8 @@ public class AndroidInput extends InputHandler{ if(!Vars.control.hasItems(player.recipe.requirements)){ Cursors.restoreCursor(); } + return true; } + return false; } } diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index bf19570e7d..5e4e12bcb8 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -94,7 +94,7 @@ public class DesktopInput extends InputHandler{ Tile cursor = world.tile(tilex(), tiley()); - if(Inputs.buttonUp(Buttons.LEFT) && cursor != null){ + if(Inputs.buttonUp(Buttons.LEFT) && cursor != null && !ui.hasMouse()){ Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor; if(linked != null && linked.block() instanceof Configurable){ ui.showConfig(linked); diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 11d7b3ec49..6928fec28b 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -49,7 +49,7 @@ public abstract class InputHandler extends InputAdapter{ return Vector2.dst(player.x, player.y, getBlockX() * tilesize, getBlockY() * tilesize) <= placerange; } - public void tryPlaceBlock(int x, int y, boolean sound){ + public boolean tryPlaceBlock(int x, int y, boolean sound){ if(player.recipe != null && validPlace(x, y, player.recipe.result) && !ui.hasMouse() && cursorNear() && Vars.control.hasItems(player.recipe.requirements)){ @@ -63,7 +63,9 @@ public abstract class InputHandler extends InputAdapter{ if(!Vars.control.hasItems(player.recipe.requirements)){ Cursors.restoreCursor(); } + return true; } + return false; } public boolean tryDeleteBlock(int x, int y, boolean sound){ diff --git a/core/src/io/anuke/mindustry/input/PlaceMode.java b/core/src/io/anuke/mindustry/input/PlaceMode.java index 18771da2a9..64fbb35a0a 100644 --- a/core/src/io/anuke/mindustry/input/PlaceMode.java +++ b/core/src/io/anuke/mindustry/input/PlaceMode.java @@ -306,10 +306,12 @@ public enum PlaceMode{ boolean first = true; for(int x = 0; x <= Math.abs(this.endx - this.tilex); x ++){ for(int y = 0; y <= Math.abs(this.endy - this.tiley); y ++){ - control.getInput().tryPlaceBlock( + if(control.getInput().tryPlaceBlock( tilex + x * Mathf.sign(endx - tilex), - tiley + y * Mathf.sign(endy - tiley), first); - first = false; + tiley + y * Mathf.sign(endy - tiley), first)){ + first = false; + } + } } } diff --git a/core/src/io/anuke/mindustry/mapeditor/EditorTool.java b/core/src/io/anuke/mindustry/mapeditor/EditorTool.java new file mode 100644 index 0000000000..0699ae5812 --- /dev/null +++ b/core/src/io/anuke/mindustry/mapeditor/EditorTool.java @@ -0,0 +1,70 @@ +package io.anuke.mindustry.mapeditor; + +import java.util.Stack; + +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.math.GridPoint2; +import com.badlogic.gdx.utils.IntSet; + +import io.anuke.mindustry.Vars; +import io.anuke.mindustry.world.Block; +import io.anuke.mindustry.world.ColorMapper; + +public enum EditorTool{ + pencil{ + public void touched(MapEditor editor, int x, int y){ + editor.draw(x, y); + } + }, + fill{ + public void touched(MapEditor editor, int x, int y){ + Pixmap pix = editor.pixmap(); + + int dest = pix.getPixel(x, y); + + int width = pix.getWidth(); + + IntSet set = new IntSet(); + Stack points = new Stack(); + points.add(new GridPoint2(x, y)); + + while( !points.isEmpty()){ + GridPoint2 pos = points.pop(); + set.add(asInt(pos.x, pos.y, width)); + + int pcolor = pix.getPixel(pos.x, pos.y); + if(colorEquals(pcolor, dest)){ + + pix.drawPixel(pos.x, pos.y); + + if(pos.x > 0 && !set.contains(asInt(pos.x - 1, pos.y, width))) points.add(new GridPoint2(pos).cpy().add( -1, 0)); + if(pos.y > 0 && !set.contains(asInt(pos.x, pos.y - 1, width))) points.add(new GridPoint2(pos).cpy().add(0, -1)); + if(pos.x < pix.getWidth() - 1 && !set.contains(asInt(pos.x + 1, pos.y, width))) points.add(new GridPoint2(pos).cpy().add(1, 0)); + if(pos.y < pix.getHeight() - 1 && !set.contains(asInt(pos.x, pos.y + 1, width))) points.add(new GridPoint2(pos).cpy().add(0, 1)); + } + } + + editor.updateTexture(); + } + + int asInt(int x, int y, int width){ + return x+y*width; + } + + boolean colorEquals(int a, int b){ + return a == b; + } + }, + pick{ + public void touched(MapEditor editor, int x, int y){ + Block block = ColorMapper.get(editor.pixmap().getPixel(x, y)).dominant(); + editor.setDrawBlock(block); + Vars.ui.getEditor().updateSelectedBlock(); + } + }, + zoom; + + public void touched(MapEditor editor, int x, int y){ + + } +} diff --git a/core/src/io/anuke/mindustry/mapeditor/MapEditor.java b/core/src/io/anuke/mindustry/mapeditor/MapEditor.java index 8281410fe2..cb28feac05 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapEditor.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapEditor.java @@ -19,6 +19,11 @@ public class MapEditor{ private Pixmap[] brushPixmaps = new Pixmap[brushSizes.length]; private Map map; + + private MapFilter filter = new MapFilter(); + private Pixmap filterPixmap; + private Texture filterTexture; + private Pixmap pixmap; private Texture texture; private int brushSize = 1; @@ -31,6 +36,44 @@ public class MapEditor{ } } + public void updateTexture(){ + texture.draw(pixmap, 0, 0); + } + + public MapFilter getFilter(){ + return filter; + } + + public void applyFilterPreview(){ + if(filterPixmap != null && (filterPixmap.getWidth() != pixmap.getWidth() + || filterPixmap.getHeight() != pixmap.getHeight())){ + filterPixmap.dispose(); + filterTexture.dispose(); + filterPixmap = null; + filterTexture = null; + } + + if(filterPixmap == null){ + filterPixmap = Pixmaps.copy(pixmap); + filter.process(filterPixmap); + filterTexture = new Texture(filterPixmap); + }else{ + filterPixmap.drawPixmap(pixmap, 0, 0); + filter.process(filterPixmap); + filterTexture.draw(filterPixmap, 0, 0); + } + + } + + public Texture getFilterTexture(){ + return filterTexture; + } + + public void applyFilter(){ + filter.process(pixmap); + texture.draw(pixmap, 0, 0); + } + public void beginEdit(Map map){ this.map = map; this.brushSize = 1; @@ -87,7 +130,7 @@ public class MapEditor{ y = 0; } - pixmap.fillCircle(dx, dy, brushSize); + pixmap.fillCircle(dx, dy, brushSize-1); Pixmap dst = brush(brushSize); dst.drawPixmap(pixmap, x, y, dstWidth, dstHeight, 0, 0, dstWidth, dstHeight); @@ -109,6 +152,10 @@ public class MapEditor{ return texture; } + public Pixmap pixmap(){ + return pixmap; + } + public void resize(int mapSize){ Pixmap out = Pixmaps.resize(pixmap, mapSize, mapSize); pixmap.dispose(); diff --git a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java index 0627ddd01a..30c5fdd95b 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java @@ -5,6 +5,7 @@ import io.anuke.mindustry.world.ColorMapper; import io.anuke.mindustry.world.ColorMapper.BlockPair; import io.anuke.mindustry.world.Map; import io.anuke.mindustry.world.blocks.Blocks; +import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Draw; import io.anuke.ucore.scene.builders.*; import io.anuke.ucore.scene.ui.*; @@ -14,10 +15,13 @@ import io.anuke.ucore.scene.ui.layout.Unit; public class MapEditorDialog extends Dialog{ private MapEditor editor; private MapView view; + private MapGenerateDialog dialog; + private ButtonGroup blockgroup; public MapEditorDialog(MapEditor editor){ super("Map Editor", "dialog"); this.editor = editor; + dialog = new MapGenerateDialog(editor); view = new MapView(editor); setFillParent(true); @@ -30,9 +34,23 @@ public class MapEditorDialog extends Dialog{ shown(() -> { editor.beginEdit(new Map()); + Core.scene.setScrollFocus(view); }); } + public void updateSelectedBlock(){ + Block block = editor.getDrawBlock(); + int i = 0; + for(BlockPair pair : ColorMapper.getPairs()){ + if(pair.wall == block || (pair.wall == Blocks.air && pair.floor == block)){ + blockgroup.getButtons().get(i).setChecked(true); + break; + } + i++; + } + + } + public void build(){ new table(){{ @@ -40,8 +58,15 @@ public class MapEditorDialog extends Dialog{ aleft(); new table(){{ + defaults().growY().width(130f).units(Unit.dp).padBottom(-6); + new imagebutton("icon-terrain", isize, () -> { + dialog.show(); + }).text("generate").units(Unit.dp); + + row(); + new imagebutton("icon-load", isize, () -> { }).text("load map"); @@ -73,7 +98,7 @@ public class MapEditorDialog extends Dialog{ row(); new imagebutton("icon-arrow-left", isize, () -> { - + hide(); }).padBottom(0).text("back"); }}.left().growY().end(); @@ -83,9 +108,24 @@ public class MapEditorDialog extends Dialog{ }}.grow().end(); new table(){{ - new imagebutton("icon-terrain", isize, () -> { + Table tools = new Table("button"); + tools.top(); + tools.padTop(0).padBottom(6); + + ButtonGroup group = new ButtonGroup<>(); + int i = 0; + + for(EditorTool tool : EditorTool.values()){ + ImageButton button = new ImageButton("icon-" + tool.name(), "toggle"); + button.clicked(() -> view.setTool(tool)); + button.resizeImage(Unit.dp.inPixels(16*2f)); + group.add(button); - }).margin(12f).text("generate...").width(148f).units(Unit.dp); + tools.add(button).size(80f, 85f).padBottom(-6f).units(Unit.dp); + if(i++ % 2 == 1) tools.row(); + } + + add(tools).units(Unit.dp).width(160f).padBottom(-6); row(); @@ -116,6 +156,7 @@ public class MapEditorDialog extends Dialog{ pane.setFadeScrollBars(false); pane.setOverscroll(true, false); ButtonGroup group = new ButtonGroup<>(); + blockgroup = group; int i = 0; diff --git a/core/src/io/anuke/mindustry/mapeditor/MapFilter.java b/core/src/io/anuke/mindustry/mapeditor/MapFilter.java index 728630f4eb..e641e0b79f 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapFilter.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapFilter.java @@ -16,33 +16,37 @@ import io.anuke.ucore.noise.Simplex; import io.anuke.ucore.util.Mathf; public class MapFilter{ - private ObjectMap prefs = new OrderedMap(){ - { - put("replace", true); - put("terrain", false); - put("circle", false); - put("distort", false); - put("sand", false); - put("grass", false); - put("stone", false); - put("allgrass", false); - put("allsnow", false); - put("allsand", false); - put("lavarock", false); - put("water", false); - put("oil", false); - put("lavariver", false); - put("slavariver", false); - put("river", false); - put("iceriver", false); - put("oilriver", false); - } - }; + private ObjectMap prefs = map( + pref("replace", "whether to replace blocks"), + pref("terrain", "generate new terrain"), + pref("circle", "generate terrain in a circle"), + pref("distort", "distort the map image"), + pref("sand", "add patches of sand"), + pref("grass", "add patches of grass"), + pref("stone", "add patches of stone"), + pref("blackstone", "add patches of black stone"), + pref("allgrass", "fill map with grass"), + pref("allsnow", "fill map with snow"), + pref("allsand", "fill map with sand"), + pref("water", "add lakes"), + pref("oil", "add oil lakes"), + pref("lavariver", "add lava rivers"), + pref("slavariver", "ad small lava rivers"), + pref("river", "add rivers"), + pref("iceriver", "add frozen rivers"), + pref("oilriver", "add oil rivers") + ); + private Simplex sim = new Simplex(); private RidgedPerlin rid = new RidgedPerlin(1, 10, 20f); private RidgedPerlin rid2 = new RidgedPerlin(1, 6, 1f); private RidgedPerlin rid3 = new RidgedPerlin(1, 6, 1f); + public MapFilter(){ + prefs.get("replace").enabled = true; + prefs.get("terrain").enabled = true; + } + public void randomize(){ sim.setSeed(Mathf.random(999999)); rid.setSeed(Mathf.random(999999)); @@ -50,16 +54,16 @@ public class MapFilter{ rid3.setSeed(Mathf.random(999999)); } - public ObjectMap getPrefs(){ + public ObjectMap getPrefs(){ return prefs; } public Pixmap process(Pixmap pixmap){ - if(prefs.get("terrain")){ + if(prefs.get("terrain").enabled){ for(int x = 0; x < pixmap.getWidth(); x++){ for(int y = 0; y < pixmap.getHeight(); y++){ float dist = Vector2.dst((float) x / pixmap.getWidth(), (float) y / pixmap.getHeight(), 0.5f, 0.5f) * 2f; - double noise = sim.octaveNoise2D(6, 0.6, 1 / 180.0, x, y + 9999) / (prefs.get("circle") ? 1.7 : 1f) + dist / 10f; + double noise = sim.octaveNoise2D(6, 0.6, 1 / 180.0, x, y + 9999) / (prefs.get("circle").enabled ? 1.7 : 1f) + dist / 10f; if(dist > 0.8){ noise += 2 * (dist - 0.8); @@ -78,7 +82,7 @@ public class MapFilter{ for(int y = 0; y < pixmap.getHeight(); y++){ int dx = 0, dy = 0; - if(prefs.get("distort")){ + if(prefs.get("distort").enabled){ double intensity = 12; double scale = 80; double octaves = 4; @@ -105,41 +109,41 @@ public class MapFilter{ double noil = sim.octaveNoise2D(1, 1.0, 1 / 150.0, x + 9999, y) + sim.octaveNoise2D(1, 1.0, 1 / 2.0, x, y) / 290.0; - if(!floor || prefs.get("replace")){ + if(!floor || prefs.get("replace").enabled){ - if(prefs.get("allgrass")){ + if(prefs.get("allgrass").enabled){ block = floor ? Blocks.grass : Blocks.grassblock; - }else if(prefs.get("allsnow")){ + }else if(prefs.get("allsnow").enabled){ block = floor ? Blocks.snow : Blocks.snowblock; - }else if(prefs.get("allsand")){ + }else if(prefs.get("allsand").enabled){ block = floor ? Blocks.sand : Blocks.sandblock; - }else if(prefs.get("replace")){ + }else if(prefs.get("replace").enabled){ block = floor ? Blocks.stone : Blocks.stoneblock; } - if(noise > 0.7 && prefs.get("grass")){ + if(noise > 0.7 && prefs.get("grass").enabled){ block = floor ? Blocks.grass : Blocks.grassblock; } - if(noise > 0.7 && prefs.get("lavarock")){ + if(noise > 0.7 && prefs.get("blackstone").enabled){ block = floor ? Blocks.blackstone : Blocks.blackstoneblock; } - if(noise > 0.7 && prefs.get("sand")){ + if(noise > 0.7 && prefs.get("sand").enabled){ block = floor ? Blocks.sand : Blocks.sandblock; } - if(noise > 0.8 && prefs.get("stone")){ + if(noise > 0.8 && prefs.get("stone").enabled){ block = floor ? Blocks.stone : Blocks.stoneblock; } } if(floor){ - if(nwater > 0.93 && prefs.get("water")){ + if(nwater > 0.93 && prefs.get("water").enabled){ block = Blocks.water; if(nwater > 0.943){ block = Blocks.deepwater; } } - if(noil > 0.95 && prefs.get("oil")){ + if(noil > 0.95 && prefs.get("oil").enabled){ block = Blocks.dirt; if(noil > 0.955){ block = Blocks.oil; @@ -147,7 +151,7 @@ public class MapFilter{ } } - if(floor && prefs.get("lavariver")){ + if(floor && prefs.get("lavariver").enabled){ double lava = rid.getValue(x, y, 1 / 100f); double t = 0.6; if(lava > t){ @@ -157,7 +161,7 @@ public class MapFilter{ } } - if(floor && prefs.get("slavariver")){ + if(floor && prefs.get("slavariver").enabled){ double lava = rid.getValue(x, y, 1 / 40f); double t = 0.7; if(lava > t){ @@ -167,7 +171,7 @@ public class MapFilter{ } } - if(floor && prefs.get("oilriver")){ + if(floor && prefs.get("oilriver").enabled){ double lava = rid3.getValue(x, y, 1 / 100f); double t = 0.9; if(lava > t){ @@ -177,7 +181,7 @@ public class MapFilter{ } } - if(floor && prefs.get("river")){ + if(floor && prefs.get("river").enabled){ double riv = rid2.getValue(x, y, 1 / 140f); double t = 0.4; @@ -190,7 +194,7 @@ public class MapFilter{ } } - if(floor && prefs.get("iceriver")){ + if(floor && prefs.get("iceriver").enabled){ double riv = rid2.getValue(x, y, 1 / 140f); double t = 0.4; @@ -211,4 +215,29 @@ public class MapFilter{ return pixmap; } + + private static OrderedMap map(GenPref...objects){ + OrderedMap prefs = new OrderedMap<>(); + + for(int i = 0; i < objects.length; i ++){ + GenPref pref = (GenPref)objects[i]; + prefs.put(pref.name, pref); + } + return prefs; + } + + private GenPref pref(String name, String desc){ + return new GenPref(name, desc); + } + + class GenPref{ + public final String name; + public final String description; + public boolean enabled; + + GenPref(String name, String description){ + this.name = name; + this.description = description; + } + } } diff --git a/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java index 7029ed1546..cf3865018b 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapGenerateDialog.java @@ -1,5 +1,97 @@ package io.anuke.mindustry.mapeditor; -public class MapGenerateDialog{ +import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.utils.Align; +import com.badlogic.gdx.utils.Scaling; + +import io.anuke.mindustry.mapeditor.MapFilter.GenPref; +import io.anuke.mindustry.ui.BorderImage; +import io.anuke.mindustry.ui.FloatingDialog; +import io.anuke.ucore.core.Timers; +import io.anuke.ucore.scene.style.TextureRegionDrawable; +import io.anuke.ucore.scene.ui.CheckBox; +import io.anuke.ucore.scene.ui.Image; +import io.anuke.ucore.scene.ui.ScrollPane; +import io.anuke.ucore.scene.ui.layout.Stack; +import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.scene.ui.layout.Unit; + +public class MapGenerateDialog extends FloatingDialog{ + private MapEditor editor; + private Image image; + private boolean loading; + + public MapGenerateDialog(MapEditor editor) { + super("generate"); + this.editor = editor; + + Stack stack = new Stack(); + stack.add(image = new BorderImage()); + + Image loadImage = new Image("icon-loading"); + loadImage.setScaling(Scaling.none); + loadImage.setScale(3f); + loadImage.update(() -> loadImage.setOrigin(Align.center)); + loadImage.setVisible(() -> loading); + Image next = new Image("white"); + next.setScaling(Scaling.fit); + next.setColor(0, 0, 0, 0.6f); + next.setVisible(() -> loading); + + stack.add(next); + stack.add(loadImage); + + content().add(stack).grow(); + image.setScaling(Scaling.fit); + Table preft = new Table(); + preft.left(); + preft.pad(Unit.dp.inPixels(4f)).padRight(Unit.dp.inPixels(25f)); + + for(GenPref pref : editor.getFilter().getPrefs().values()){ + CheckBox box = new CheckBox(pref.name); + box.setChecked(pref.enabled); + box.changed(() -> pref.enabled = box.isChecked()); + preft.add(box).pad(4f).units(Unit.dp).left(); + preft.row(); + } + + ScrollPane pane = new ScrollPane(preft, "volume"); + pane.setFadeScrollBars(false); + pane.setScrollingDisabled(true, false); + + content().add(pane).fillY(); + + buttons().defaults().size(170f, 50f).units(Unit.dp).pad(4f); + buttons().addButton("Back", () -> hide()); + buttons().addButton("Randomize", () ->{ + editor.getFilter().randomize(); + apply(); + }); + buttons().addButton("Update", () ->{ + apply(); + }); + buttons().addButton("Apply", () ->{ + editor.applyFilter(); + hide(); + }); + + shown(() ->{ + loading = true; + Timers.run(30f, () -> { + editor.applyFilterPreview(); + image.setDrawable(new TextureRegionDrawable(new TextureRegion(editor.getFilterTexture()))); + loading = false; + }); + }); + } + + private void apply(){ + loading = true; + Timers.run(3f, ()->{ + editor.applyFilterPreview(); + loading = false; + }); + + } } diff --git a/core/src/io/anuke/mindustry/mapeditor/MapView.java b/core/src/io/anuke/mindustry/mapeditor/MapView.java index 8fda57d2f6..f478ac767a 100644 --- a/core/src/io/anuke/mindustry/mapeditor/MapView.java +++ b/core/src/io/anuke/mindustry/mapeditor/MapView.java @@ -1,21 +1,42 @@ package io.anuke.mindustry.mapeditor; +import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.input.GestureDetector; +import com.badlogic.gdx.input.GestureDetector.GestureListener; import com.badlogic.gdx.math.Bresenham2; import com.badlogic.gdx.math.GridPoint2; +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Vars; +import io.anuke.ucore.core.Core; +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Inputs; import io.anuke.ucore.scene.Element; import io.anuke.ucore.scene.event.InputEvent; import io.anuke.ucore.scene.event.InputListener; +import io.anuke.ucore.scene.ui.layout.Unit; +import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Tmp; -public class MapView extends Element{ +public class MapView extends Element implements GestureListener{ private MapEditor editor; + private EditorTool tool = EditorTool.pencil; private Bresenham2 br = new Bresenham2(); + private float offsetx, offsety; + private float zoom = 1f; + + public void setTool(EditorTool tool){ + this.tool = tool; + } public MapView(MapEditor editor){ this.editor = editor; + + Inputs.addProcessor(0, new GestureDetector(20, 0.5f, 2, 0.15f, this)); + addListener(new InputListener(){ int lastx, lasty; boolean drawing; @@ -25,7 +46,9 @@ public class MapView extends Element{ GridPoint2 p = project(x, y); lastx = p.x; lasty = p.y; - editor.draw(p.x, p.y); + tool.touched(editor, p.x, p.y); + + drawing = true; return true; } @@ -38,29 +61,131 @@ public class MapView extends Element{ public void touchDragged (InputEvent event, float x, float y, int pointer) { GridPoint2 p = project(x, y); - if(drawing){ + if(drawing && tool == EditorTool.pencil){ Array points = br.line(lastx, lasty, p.x, p.y); for(GridPoint2 point : points){ editor.draw(point.x, point.y); } } - drawing = true; lastx = p.x; lasty = p.y; } }); + + addListener(new InputListener(){ + @Override + public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { + return tool == EditorTool.zoom; + } + + + @Override + public void touchDragged (InputEvent event, float x, float y, int pointer) { + //offsetx += Gdx.input.getDeltaX(pointer) / zoom; + //offsety -= Gdx.input.getDeltaY(pointer) / zoom; + } + }); + } + + @Override + public void act(float delta){ + super.act(delta); + + float size = Math.min(width, height); + offsetx = Mathf.clamp(offsetx, -size, size); + offsety = Mathf.clamp(offsety, -size, size); + + if(tool != EditorTool.zoom) return; + + zoom += Inputs.scroll()/10f * zoom; + clampZoom(); + } + + private void clampZoom(){ + zoom = Mathf.clamp(zoom, 0.4f, 6f); } private GridPoint2 project(float x, float y){ - float size = Math.min(width, height); - x = (x - getWidth()/2 + size/2) / size * editor.texture().getWidth(); - y = (y - getHeight()/2 + size/2) / size * editor.texture().getHeight(); + float size = Math.min(width, height)*zoom; + x = (x - getWidth()/2 + size/2 - offsetx*zoom) / size * editor.texture().getWidth(); + y = (y - getHeight()/2 + size/2 - offsety*zoom) / size * editor.texture().getHeight(); return Tmp.g1.set((int)x, editor.texture().getHeight() - 1 - (int)y); } @Override public void draw(Batch batch, float alpha){ float size = Math.min(width, height); - batch.draw(editor.texture(), x + width/2 - size/2, y + height/2 - size/2, size, size); + float sclsize = size * zoom; + float centerx = x + width/2 + offsetx * zoom; + float centery = y + height/2 + offsety * zoom; + + batch.flush(); + ScissorStack.pushScissors(Tmp.r1.set(x + width/2 - size/2, y + height/2 - size/2, size, size)); + + batch.draw(editor.texture(), centerx - sclsize/2, centery - sclsize/2, sclsize, sclsize); + batch.flush(); + + ScissorStack.popScissors(); + + Draw.color(Colors.get("accent")); + Draw.thick(Unit.dp.inPixels(3f)); + Draw.linerect(x + width/2 - size/2, y + height/2 - size/2, size, size); + Draw.reset(); + } + + private boolean active(){ + return Core.scene.getKeyboardFocus().isDescendantOf(Vars.ui.getEditor()) && Vars.ui.isEditing() && tool == EditorTool.zoom; + } + + @Override + public boolean touchDown(float x, float y, int pointer, int button){ + return false; + } + + @Override + public boolean tap(float x, float y, int count, int button){ + return false; + } + + @Override + public boolean longPress(float x, float y){ + return false; + } + + @Override + public boolean fling(float velocityX, float velocityY, int button){ + return false; + } + + @Override + public boolean pan(float x, float y, float deltaX, float deltaY){ + if(!active()) return false; + offsetx += deltaX / zoom; + offsety -= deltaY / zoom; + return false; + } + + @Override + public boolean panStop(float x, float y, int pointer, int button){ + return false; + } + + @Override + public boolean zoom(float initialDistance, float distance){ + if(!active()) return false; + float nzoom = distance - initialDistance; + zoom += nzoom / 2000f / Unit.dp.inPixels(1f) * zoom; + clampZoom(); + return false; + } + + @Override + public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2){ + return false; + } + + @Override + public void pinchStop(){ + } } diff --git a/core/src/io/anuke/mindustry/ui/BorderImage.java b/core/src/io/anuke/mindustry/ui/BorderImage.java new file mode 100644 index 0000000000..4b15783ab0 --- /dev/null +++ b/core/src/io/anuke/mindustry/ui/BorderImage.java @@ -0,0 +1,24 @@ +package io.anuke.mindustry.ui; + +import com.badlogic.gdx.graphics.Colors; +import com.badlogic.gdx.graphics.g2d.Batch; + +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.scene.ui.Image; +import io.anuke.ucore.scene.ui.layout.Unit; + +public class BorderImage extends Image{ + + @Override + public void draw(Batch batch, float alpha){ + super.draw(batch, alpha); + + float scaleX = getScaleX(); + float scaleY = getScaleY(); + + Draw.color(Colors.get("accent")); + Draw.thick(Unit.dp.inPixels(3f)); + Draw.linerect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY); + Draw.reset(); + } +} diff --git a/core/src/io/anuke/mindustry/world/ColorMapper.java b/core/src/io/anuke/mindustry/world/ColorMapper.java index e73dbf60f1..011addbc80 100644 --- a/core/src/io/anuke/mindustry/world/ColorMapper.java +++ b/core/src/io/anuke/mindustry/world/ColorMapper.java @@ -69,6 +69,10 @@ public class ColorMapper{ public static class BlockPair{ public final Block floor, wall; + public Block dominant(){ + return wall == Blocks.air ? floor : wall; + } + private BlockPair(Block floor, Block wall){ this.floor = floor; this.wall = wall; diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index 76559b3714..97090f5ab0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -55,7 +55,7 @@ public class ProductionBlocks{ requirements = new Item[]{Item.coal, Item.iron}; result = Item.steel; description = "Converts coal + iron to steel."; - fullDescription = "The essential crafting block. When inputted 1x iron and 1x iron, outputs one steel."; + fullDescription = "The essential crafting block. When inputted 1x iron and 1x coal, outputs one steel."; } }, diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java index 4b0bba12ab..e5aa2db029 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/ShieldBlock.java @@ -75,7 +75,7 @@ public class ShieldBlock extends PowerBlock{ } bullet.remove(); - Effects.effect(Fx.laserhit, bullet); + Effects.effect(bullet.damage > 5 ? Fx.shieldhit : Fx.laserhit, bullet); Vars.renderer.addShieldHit(bullet.x, bullet.y); entity.power -= bullet.getDamage() * powerPerDamage; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/TunnelConveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/TunnelConveyor.java index 49944067e3..6235725047 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/TunnelConveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/TunnelConveyor.java @@ -31,7 +31,6 @@ public class TunnelConveyor extends Block{ if(to == null || to.entity == null) return; to.block().handleItem(item, to, tunnel); }); - } @Override diff --git a/desktop/src/io/anuke/mindustry/desktop/EditorLauncher.java b/desktop/src/io/anuke/mindustry/desktop/EditorLauncher.java deleted file mode 100644 index e6dd6015b1..0000000000 --- a/desktop/src/io/anuke/mindustry/desktop/EditorLauncher.java +++ /dev/null @@ -1,18 +0,0 @@ -package io.anuke.mindustry.desktop; - -import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; -import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; - -import io.anuke.mindustry.editor.Editor; - -public class EditorLauncher{ - public static void main (String[] arg) { - Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); - config.setTitle("Mindustry Editor"); - config.setMaximized(true); - config.setWindowedMode(800, 600); - config.setWindowIcon("sprites/icon.png"); - - new Lwjgl3Application(new Editor(), config); - } -}