diff --git a/build.gradle b/build.gradle index 3bce61141a..b49e29f31f 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.Anuken:ucore:bd4474d8e5' + compile 'com.github.Anuken:ucore:d9bf5ef' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/assets-raw/sprites/laserfull.png b/core/assets-raw/sprites/laserfull.png new file mode 100644 index 0000000000..9ea6687b8f Binary files /dev/null and b/core/assets-raw/sprites/laserfull.png differ diff --git a/core/assets/maps/test3.png b/core/assets/maps/test3.png index 34e5a233de..8209a06331 100644 Binary files a/core/assets/maps/test3.png and b/core/assets/maps/test3.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index 60e59018fb..31d18dbc14 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -20,77 +20,77 @@ blank index: -1 blocks/blackrock1 rotate: false - xy: 95, 1 + xy: 519, 179 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackrockshadow1 rotate: false - xy: 105, 1 + xy: 722, 405 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone1 rotate: false - xy: 519, 179 + xy: 722, 395 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone2 rotate: false - xy: 722, 381 + xy: 722, 385 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstone3 rotate: false - xy: 732, 381 + xy: 734, 418 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock1 rotate: false - xy: 740, 323 + xy: 498, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock2 rotate: false - xy: 740, 313 + xy: 508, 110 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneblock3 rotate: false - xy: 224, 95 + xy: 406, 99 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/blackstoneedge rotate: false - xy: 656, 246 + xy: 1011, 499 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/block rotate: false - xy: 244, 95 + xy: 165, 76 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/block-2x2 rotate: false - xy: 169, 90 + xy: 428, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -104,126 +104,126 @@ blocks/block-3x3 index: -1 blocks/chainturret rotate: false - xy: 428, 113 + xy: 747, 430 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/chainturret-icon rotate: false - xy: 115, 2 + xy: 569, 215 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/coal1 rotate: false - xy: 264, 95 + xy: 224, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal2 rotate: false - xy: 274, 95 + xy: 234, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal3 rotate: false - xy: 284, 95 + xy: 244, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coaldrill rotate: false - xy: 294, 95 + xy: 254, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalgenerator rotate: false - xy: 304, 95 + xy: 264, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalgenerator-top rotate: false - xy: 314, 95 + xy: 274, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalpurifier rotate: false - xy: 324, 95 + xy: 284, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/combustiongenerator rotate: false - xy: 334, 95 + xy: 294, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/compositewall rotate: false - xy: 344, 95 + xy: 304, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduit rotate: false - xy: 354, 95 + xy: 314, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitbottom rotate: false - xy: 364, 95 + xy: 324, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitliquid rotate: false - xy: 374, 95 + xy: 334, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduittop rotate: false - xy: 384, 95 + xy: 344, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyor rotate: false - xy: 394, 95 + xy: 354, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyormove rotate: false - xy: 684, 250 + xy: 364, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyortunnel rotate: false - xy: 694, 251 + xy: 374, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -237,112 +237,112 @@ blocks/core index: -1 blocks/cross rotate: false - xy: 704, 253 + xy: 384, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/crucible rotate: false - xy: 169, 80 + xy: 394, 83 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/deepwater rotate: false - xy: 179, 80 + xy: 404, 89 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt1 rotate: false - xy: 165, 70 + xy: 414, 89 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt2 rotate: false - xy: 175, 70 + xy: 404, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt3 rotate: false - xy: 171, 60 + xy: 414, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirtedge rotate: false - xy: 670, 246 + xy: 1011, 485 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/door rotate: false - xy: 171, 50 + xy: 115, 4 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/door-large rotate: false - xy: 747, 430 + xy: 446, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/door-large-icon rotate: false - xy: 171, 40 + xy: 163, 30 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/door-large-open rotate: false - xy: 446, 113 + xy: 464, 113 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/door-open rotate: false - xy: 174, 30 + xy: 163, 20 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/doubleturret rotate: false - xy: 583, 215 + xy: 529, 177 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/duriumwall rotate: false - xy: 514, 114 + xy: 167, 10 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/duriumwall-large rotate: false - xy: 464, 113 + xy: 661, 292 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/duriumwall-large-icon rotate: false - xy: 733, 275 + xy: 724, 375 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -356,245 +356,245 @@ blocks/flameturret index: -1 blocks/fluxpump rotate: false - xy: 416, 99 + xy: 724, 355 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass1 rotate: false - xy: 428, 103 + xy: 724, 345 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass2 rotate: false - xy: 438, 103 + xy: 428, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass3 rotate: false - xy: 448, 103 + xy: 438, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock1 rotate: false - xy: 458, 103 + xy: 448, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock2 rotate: false - xy: 468, 103 + xy: 458, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassedge rotate: false - xy: 157, 40 + xy: 157, 54 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/ice1 rotate: false - xy: 684, 240 + xy: 468, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice2 rotate: false - xy: 694, 241 + xy: 518, 114 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ice3 rotate: false - xy: 704, 243 + xy: 175, 76 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iceedge rotate: false - xy: 524, 217 + xy: 157, 40 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/icerock1 rotate: false - xy: 185, 70 + xy: 185, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerock2 rotate: false - xy: 181, 60 + xy: 195, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow1 rotate: false - xy: 181, 50 + xy: 205, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow1 rotate: false - xy: 181, 50 + xy: 205, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/icerockshadow2 rotate: false - xy: 181, 40 + xy: 728, 335 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow2 rotate: false - xy: 181, 40 + xy: 728, 335 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron1 rotate: false - xy: 592, 238 + xy: 488, 95 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron2 rotate: false - xy: 602, 238 + xy: 498, 90 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron3 rotate: false - xy: 612, 238 + xy: 508, 90 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/irondrill rotate: false - xy: 622, 238 + xy: 518, 94 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ironwall rotate: false - xy: 632, 238 + xy: 518, 84 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/junction rotate: false - xy: 642, 238 + xy: 592, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/laserturret rotate: false - xy: 724, 345 + xy: 344, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/lava rotate: false - xy: 591, 228 + xy: 602, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/lavaedge rotate: false - xy: 538, 217 + xy: 524, 217 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/lavasmelter rotate: false - xy: 601, 228 + xy: 612, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquiditemjunction rotate: false - xy: 611, 228 + xy: 622, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidjunction rotate: false - xy: 621, 228 + xy: 632, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidrouter rotate: false - xy: 631, 228 + xy: 642, 238 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/machineturret rotate: false - xy: 728, 333 + xy: 356, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/megarepairturret rotate: false - xy: 728, 321 + xy: 368, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mortarturret rotate: false - xy: 728, 309 + xy: 380, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/mossblock rotate: false - xy: 595, 218 + xy: 601, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/mossstone rotate: false - xy: 595, 218 + xy: 601, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -615,7 +615,7 @@ blocks/nuclearreactor-center index: -1 blocks/nuclearreactor-icon rotate: false - xy: 615, 218 + xy: 621, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -629,434 +629,434 @@ blocks/nuclearreactor-lights index: -1 blocks/nuclearreactor-small rotate: false - xy: 661, 292 + xy: 679, 292 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/oil rotate: false - xy: 625, 218 + xy: 631, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/oiledge rotate: false - xy: 519, 189 + xy: 519, 203 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/oilrefinery rotate: false - xy: 635, 218 + xy: 641, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/omnidrill rotate: false - xy: 645, 218 + xy: 593, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/plasmaturret rotate: false - xy: 731, 297 + xy: 392, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/powerbooster rotate: false - xy: 651, 228 + xy: 603, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyor rotate: false - xy: 655, 218 + xy: 613, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyormove rotate: false - xy: 742, 382 + xy: 623, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaser rotate: false - xy: 743, 303 + xy: 633, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlasercorner rotate: false - xy: 187, 91 + xy: 643, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaserrouter rotate: false - xy: 197, 91 + xy: 714, 269 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduit rotate: false - xy: 207, 91 + xy: 714, 259 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduitbottom rotate: false - xy: 189, 81 + xy: 714, 249 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pulseconduittop rotate: false - xy: 199, 81 + xy: 724, 271 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pump rotate: false - xy: 195, 71 + xy: 724, 261 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/repairturret rotate: false - xy: 733, 285 + xy: 131, 8 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/rock1 rotate: false - xy: 205, 71 + xy: 712, 239 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 201, 61 + xy: 744, 418 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 201, 51 + xy: 754, 420 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rtgenerator rotate: false - xy: 201, 41 + xy: 688, 237 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rtgenerator-top rotate: false - xy: 204, 31 + xy: 185, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand1 rotate: false - xy: 215, 71 + xy: 195, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand2 rotate: false - xy: 211, 61 + xy: 205, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sand3 rotate: false - xy: 211, 51 + xy: 734, 408 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock1 rotate: false - xy: 211, 41 + xy: 744, 408 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock2 rotate: false - xy: 214, 31 + xy: 754, 410 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandblock3 rotate: false - xy: 221, 61 + xy: 732, 398 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sandedge rotate: false - xy: 533, 203 + xy: 519, 189 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/shadow rotate: false - xy: 498, 108 + xy: 143, 8 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shieldgenerator rotate: false - xy: 221, 41 + xy: 742, 398 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shotgunturret rotate: false - xy: 162, 28 + xy: 155, 8 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shrub rotate: false - xy: 714, 259 + xy: 734, 368 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shrubshadow rotate: false - xy: 714, 249 + xy: 734, 358 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/smelter rotate: false - xy: 714, 239 + xy: 734, 348 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sniperturret rotate: false - xy: 736, 369 + xy: 541, 177 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/snow1 rotate: false - xy: 704, 233 + xy: 744, 378 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snow2 rotate: false - xy: 694, 231 + xy: 744, 368 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snow3 rotate: false - xy: 714, 229 + xy: 744, 358 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock1 rotate: false - xy: 704, 223 + xy: 744, 348 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock2 rotate: false - xy: 714, 219 + xy: 738, 338 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowblock3 rotate: false - xy: 498, 98 + xy: 738, 328 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/snowedge rotate: false - xy: 533, 189 + xy: 533, 203 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/sorter rotate: false - xy: 488, 95 + xy: 738, 318 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyor rotate: false - xy: 595, 208 + xy: 748, 338 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyormove rotate: false - xy: 605, 208 + xy: 748, 328 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelwall rotate: false - xy: 615, 208 + xy: 748, 318 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelwall-large rotate: false - xy: 679, 292 + xy: 697, 291 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/steelwall-large-icon rotate: false - xy: 625, 208 + xy: 593, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone1 rotate: false - xy: 635, 208 + xy: 603, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone2 rotate: false - xy: 645, 208 + xy: 613, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone3 rotate: false - xy: 655, 208 + xy: 623, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock1 rotate: false - xy: 748, 372 + xy: 633, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock2 rotate: false - xy: 748, 362 + xy: 643, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock3 rotate: false - xy: 748, 352 + xy: 651, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonedrill rotate: false - xy: 498, 88 + xy: 653, 218 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneedge rotate: false - xy: 555, 213 + xy: 533, 189 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/stoneformer rotate: false - xy: 781, 446 + xy: 653, 208 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonewall rotate: false - xy: 781, 436 + xy: 661, 234 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter rotate: false - xy: 791, 446 + xy: 671, 234 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter-top rotate: false - xy: 791, 436 + xy: 663, 224 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/thermalgenerator rotate: false - xy: 801, 446 + xy: 663, 214 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1070,133 +1070,133 @@ blocks/titancannon index: -1 blocks/titancannon-icon rotate: false - xy: 736, 357 + xy: 709, 279 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/titanium1 rotate: false - xy: 801, 436 + xy: 673, 224 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium2 rotate: false - xy: 781, 426 + xy: 673, 214 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium3 rotate: false - xy: 791, 426 + xy: 663, 204 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumdrill rotate: false - xy: 801, 426 + xy: 673, 204 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumpurifier rotate: false - xy: 521, 167 + xy: 738, 308 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 521, 157 + xy: 748, 308 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 531, 167 + xy: 547, 197 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall-large rotate: false - xy: 147, 68 + xy: 881, 495 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 blocks/titaniumwall-large-icon rotate: false - xy: 521, 147 + xy: 557, 203 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/turret rotate: false - xy: 736, 345 + xy: 721, 281 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/uranium1 rotate: false - xy: 521, 137 + xy: 741, 298 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 531, 147 + xy: 751, 298 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 541, 157 + xy: 733, 288 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 531, 137 + xy: 743, 288 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 541, 147 + xy: 753, 288 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/wateredge rotate: false - xy: 569, 213 + xy: 555, 213 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 blocks/waveturret rotate: false - xy: 740, 333 + xy: 722, 415 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 bullet rotate: false - xy: 254, 95 + xy: 702, 241 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1210,7 +1210,7 @@ chainbullet index: -1 circle rotate: false - xy: 95, 11 + xy: 169, 89 size: 17, 17 orig: 17, 17 offset: 0, 0 @@ -1224,56 +1224,56 @@ circle2 index: -1 enemies/blastenemy-t1 rotate: false - xy: 881, 497 + xy: 899, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/blastenemy-t2 rotate: false - xy: 897, 497 + xy: 915, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/blastenemy-t3 rotate: false - xy: 913, 497 + xy: 931, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t1 rotate: false - xy: 929, 497 + xy: 947, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t2 rotate: false - xy: 945, 497 + xy: 963, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/empenemy-t3 rotate: false - xy: 961, 497 + xy: 979, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/enemy-t1 rotate: false - xy: 977, 497 + xy: 995, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/targetenemy-t1 rotate: false - xy: 977, 497 + xy: 995, 497 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -1287,49 +1287,49 @@ enemies/enemy-t2 index: -1 enemies/enemy-t3 rotate: false - xy: 157, 54 + xy: 688, 247 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 enemies/fastenemy-t1 rotate: false - xy: 993, 497 + xy: 765, 432 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/fastenemy-t2 rotate: false - xy: 1009, 497 + xy: 482, 115 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/fastenemy-t3 rotate: false - xy: 765, 432 + xy: 715, 293 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t1 rotate: false - xy: 482, 115 + xy: 498, 120 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t2 rotate: false - xy: 715, 293 + xy: 115, 14 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/flamerenemy-t3 rotate: false - xy: 114, 14 + xy: 141, 52 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -1357,105 +1357,105 @@ enemies/fortressenemy-t3 index: -1 enemies/healerenemy-t1 rotate: false - xy: 498, 120 + xy: 141, 36 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/healerenemy-t2 rotate: false - xy: 141, 52 + xy: 131, 20 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/healerenemy-t3 rotate: false - xy: 141, 36 + xy: 147, 20 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t1 rotate: false - xy: 608, 264 + xy: 624, 264 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t2 rotate: false - xy: 608, 248 + xy: 624, 248 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/mortarenemy-t3 rotate: false - xy: 624, 264 + xy: 640, 264 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t1 rotate: false - xy: 624, 248 + xy: 640, 248 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t2 rotate: false - xy: 640, 264 + xy: 693, 275 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/rapidenemy-t3 rotate: false - xy: 640, 248 + xy: 656, 260 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t1 rotate: false - xy: 693, 275 + xy: 672, 260 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t2 rotate: false - xy: 656, 260 + xy: 656, 244 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/tankenemy-t3 rotate: false - xy: 672, 260 + xy: 672, 244 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 enemies/titanenemy-t1 rotate: false - xy: 697, 291 + xy: 555, 227 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 enemies/titanenemy-t2 rotate: false - xy: 555, 227 + xy: 573, 227 size: 16, 16 orig: 16, 16 offset: 0, 0 index: -1 enemies/titanenemy-t3 rotate: false - xy: 573, 227 + xy: 147, 68 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -1469,49 +1469,49 @@ enemyarrow index: -1 icon-coal rotate: false - xy: 184, 30 + xy: 728, 325 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-dirium rotate: false - xy: 478, 103 + xy: 728, 315 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-iron rotate: false - xy: 488, 105 + xy: 478, 103 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-steel rotate: false - xy: 191, 60 + xy: 488, 105 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-stone rotate: false - xy: 191, 50 + xy: 498, 100 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-titanium rotate: false - xy: 191, 40 + xy: 508, 100 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-uranium rotate: false - xy: 194, 30 + xy: 518, 104 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1530,37 +1530,44 @@ laserend orig: 18, 18 offset: 0, 0 index: -1 +laserfull + rotate: false + xy: 95, 10 + size: 18, 18 + orig: 18, 18 + offset: 0, 0 + index: -1 mechs/mech-standard rotate: false - xy: 519, 203 + xy: 538, 217 size: 12, 12 orig: 12, 12 offset: 0, 0 index: -1 shell rotate: false - xy: 221, 51 + xy: 732, 388 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot rotate: false - xy: 224, 31 + xy: 742, 388 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot-long rotate: false - xy: 714, 269 + xy: 734, 378 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 titanshell rotate: false - xy: 531, 157 + xy: 557, 193 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1652,14 +1659,14 @@ ui/check-over index: -1 ui/clear rotate: false - xy: 529, 177 + xy: 581, 215 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/cursor rotate: false - xy: 89, 4 + xy: 125, 30 size: 4, 4 orig: 4, 4 offset: 0, 0 @@ -1673,21 +1680,21 @@ ui/icon-arrow-left index: -1 ui/icon-arrow-right rotate: false - xy: 130, 8 + xy: 702, 251 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-cancel rotate: false - xy: 130, 20 + xy: 597, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-check rotate: false - xy: 146, 20 + xy: 613, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 @@ -1715,147 +1722,147 @@ ui/icon-close-over index: -1 ui/icon-crafting rotate: false - xy: 142, 8 + xy: 188, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-cursor rotate: false - xy: 154, 8 + xy: 200, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-defense rotate: false - xy: 541, 177 + xy: 212, 89 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-distribution rotate: false - xy: 709, 279 + xy: 224, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-info rotate: false - xy: 721, 281 + xy: 236, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-load rotate: false - xy: 597, 280 + xy: 629, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-menu rotate: false - xy: 722, 415 + xy: 248, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-pause rotate: false - xy: 722, 403 + xy: 260, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-play rotate: false - xy: 722, 391 + xy: 272, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-play-2 rotate: false - xy: 613, 280 + xy: 645, 280 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-power rotate: false - xy: 734, 416 + xy: 284, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-production rotate: false - xy: 734, 404 + xy: 296, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-quit rotate: false - xy: 629, 280 + xy: 661, 276 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-rotate rotate: false - xy: 645, 280 + xy: 677, 276 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-rotate-arrow rotate: false - xy: 661, 276 + xy: 592, 264 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-save rotate: false - xy: 677, 276 + xy: 592, 248 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-settings rotate: false - xy: 734, 392 + xy: 308, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-tools rotate: false - xy: 592, 264 + xy: 608, 264 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-touch rotate: false - xy: 724, 369 + xy: 320, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 ui/icon-tutorial rotate: false - xy: 592, 248 + xy: 608, 248 size: 14, 14 orig: 14, 14 offset: 0, 0 index: -1 ui/icon-weapon rotate: false - xy: 724, 357 + xy: 332, 93 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -1933,14 +1940,14 @@ ui/selection index: -1 ui/separator rotate: false - xy: 89, 1 + xy: 179, 86 size: 1, 1 orig: 1, 1 offset: 0, 0 index: -1 ui/slider rotate: false - xy: 127, 4 + xy: 547, 207 size: 1, 8 orig: 1, 8 offset: 0, 0 @@ -1968,7 +1975,7 @@ ui/slider-knob-over index: -1 ui/slider-vertical rotate: false - xy: 127, 1 + xy: 169, 86 size: 8, 1 orig: 8, 1 offset: 0, 0 @@ -2047,7 +2054,7 @@ ui/textfield-over index: -1 ui/white rotate: false - xy: 125, 31 + xy: 592, 282 size: 3, 3 orig: 3, 3 offset: 0, 0 @@ -2070,42 +2077,42 @@ ui/window-empty index: -1 weapons/blaster rotate: false - xy: 234, 95 + xy: 416, 99 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/flamer rotate: false - xy: 406, 99 + xy: 724, 365 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/mortar rotate: false - xy: 641, 228 + xy: 591, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/multigun rotate: false - xy: 605, 218 + xy: 611, 228 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/railgun rotate: false - xy: 209, 81 + xy: 724, 251 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 541, 167 + xy: 731, 298 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 5057744022..67a390a345 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/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 5fbccca229..1cd5f64237 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -8,6 +8,7 @@ import com.badlogic.gdx.Input.Buttons; import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.graphics.profiling.GLProfiler; import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.FloatArray; @@ -47,8 +48,14 @@ public class Renderer extends RendererModule{ public Renderer() { Core.cameraScale = baseCameraScale; Effects.setEffectProvider((name, color, x, y, rotation) -> { - if(Settings.getBool("effects")) - new EffectEntity(name, color, rotation).set(x, y).add(); + if(Settings.getBool("effects")){ + Rectangle view = Tmp.r1.setSize(camera.viewportWidth, camera.viewportHeight) + .setCenter(camera.position.x, camera.position.y); + Rectangle pos = Tmp.r2.setSize(name.size).setCenter(x, y); + if(view.overlaps(pos)){ + new EffectEntity(name, color, rotation).set(x, y).add(); + } + } }); } diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index 2e730f7cae..cdbec2fa94 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -4,7 +4,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import com.badlogic.gdx.utils.ObjectMap; +import com.badlogic.gdx.utils.ObjectIntMap; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.effect.Fx; @@ -19,10 +19,12 @@ import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.Entity; import io.anuke.ucore.util.Mathf; +import io.anuke.ucore.util.Timer; public class TileEntity extends Entity{ public Tile tile; - public ObjectMap items = new ObjectMap<>(); + public ObjectIntMap items = new ObjectIntMap<>(); + public Timer timer; public int maxhealth, health; public boolean dead = false; public boolean added; @@ -37,8 +39,10 @@ public class TileEntity extends Entity{ maxhealth = tile.block().health; health = maxhealth; + timer = new Timer(tile.block().timers); + if(added){ - add(Entities.getGroup(TileEntity.class)); + add(); } return this; @@ -79,12 +83,12 @@ public class TileEntity extends Entity{ } public boolean collide(Bullet other){ - return other.owner instanceof Enemy; //TODO + return other.owner instanceof Enemy; } @Override public void update(){ - if(health != 0 && !(tile.block() instanceof Wall) && + if(health != 0 && health < tile.block().health && !(tile.block() instanceof Wall) && Mathf.chance(0.009f*Timers.delta()*(1f-(float)health/maxhealth))){ Effects.effect(Fx.smoke, x+Mathf.range(4), y+Mathf.range(4)); @@ -120,4 +124,9 @@ public class TileEntity extends Entity{ public void removeItem(Item item, int amount){ items.put(item, items.get(item, 0) - amount); } + + @Override + public TileEntity add(){ + return add(Entities.getGroup(TileEntity.class)); + } } diff --git a/core/src/io/anuke/mindustry/entities/WaveCreator.java b/core/src/io/anuke/mindustry/entities/WaveCreator.java index 11a1f69390..016b893334 100644 --- a/core/src/io/anuke/mindustry/entities/WaveCreator.java +++ b/core/src/io/anuke/mindustry/entities/WaveCreator.java @@ -71,7 +71,7 @@ public class WaveCreator{ after = 12; amount = 3; spacing = 5; - scaling = 2; + scaling = 3; }}, new EnemySpawn(EmpEnemy.class){{ @@ -107,7 +107,7 @@ public class WaveCreator{ new EnemySpawn(HealerEnemy.class){{ after = 16; spacing = 5; - scaling = 1; + scaling = 2; amount = 2; }}, //end boss wave @@ -117,14 +117,14 @@ public class WaveCreator{ after = 16 + 5; amount = 1; spacing = 5; - scaling = 1; + scaling = 2; }}, new EnemySpawn(EmpEnemy.class){{ after = 16 + 5; amount = 1; spacing = 5; - scaling = 1; + scaling = 2; }} //end enchanced boss wave ); diff --git a/core/src/io/anuke/mindustry/entities/effect/Fx.java b/core/src/io/anuke/mindustry/entities/effect/Fx.java index f5a4ea6fe4..9dfefbbbb7 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Fx.java +++ b/core/src/io/anuke/mindustry/entities/effect/Fx.java @@ -17,7 +17,7 @@ public class Fx{ public static final Effect - generatorexplosion = new Effect(28, e -> { + generatorexplosion = new Effect(28, 40f, e -> { Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y)->{ float size = e.fract()*12f + 1f; Draw.color(Color.WHITE, lightOrange, e.ifract()); @@ -44,7 +44,7 @@ public class Fx{ }); }), - nuclearcloud = new Effect(90, e -> { + nuclearcloud = new Effect(90, 200f, e -> { Angles.randLenVectors(e.id, 10, e.powfract()*90f, (x, y)->{ float size = e.fract()*14f; Draw.color(Color.LIME, Color.GRAY, e.ifract()); @@ -106,14 +106,14 @@ public class Fx{ Draw.reset(); }), - shockwave = new Effect(10f, e -> { + shockwave = new Effect(10f, 80f, e -> { Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); Draw.thick(e.fract()*2f + 0.2f); Draw.circle(e.x, e.y, e.ifract()*28f); Draw.reset(); }), - nuclearShockwave = new Effect(10f, e -> { + nuclearShockwave = new Effect(10f, 200f, e -> { Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); Draw.thick(e.fract()*3f + 0.2f); Draw.polygon(40, e.x, e.y, e.ifract()*140f); @@ -366,7 +366,7 @@ public class Fx{ Draw.reset(); }), - titanExplosion = new Effect(11, e -> { + titanExplosion = new Effect(11, 48f, e -> { Draw.thickness(2f*e.fract()+0.5f); Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract()); Draw.circle(e.x, e.y, 5f + e.powfract() * 8f); diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index 0cd0472b66..67a3ad8751 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -11,15 +11,15 @@ import io.anuke.mindustry.entities.effect.Shaders; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.*; import io.anuke.ucore.entities.*; -import io.anuke.ucore.util.Angles; -import io.anuke.ucore.util.Mathf; -import io.anuke.ucore.util.Tmp; +import io.anuke.ucore.util.*; public class Enemy extends DestructibleEntity{ public final static Color[] tierColors = { Color.valueOf("ffe451"), Color.valueOf("f48e20"), Color.valueOf("ff6757"), Color.valueOf("ff2d86") }; public final static int maxtier = 4; public final static float maxIdle = 60*1.5f; - + + protected int timeid; + protected Timer timer = new Timer(5); protected float speed = 0.4f; protected float reload = 32; protected float range = 60; @@ -37,7 +37,7 @@ public class Enemy extends DestructibleEntity{ protected boolean stopNearCore = true; protected float mass = 1f; - public float idletime = 0f; + public float idletime = 0f; public int spawn; public int node = -1; public Tile[] path; @@ -45,6 +45,9 @@ public class Enemy extends DestructibleEntity{ public float xvelocity, yvelocity; public Entity target; public int tier = 1; + + protected final int timerTarget = timeid ++; + protected final int timerReload = timeid ++; public Enemy() { hitbox.setSize(5f); @@ -110,7 +113,7 @@ public class Enemy extends DestructibleEntity{ target = null; } - if(Timers.get(this, "target", 15) && !nearCore){ + if(timer.get(timerTarget, 15) && !nearCore){ target = Vars.world.findTileTarget(x, y, null, range, false); //no tile found @@ -127,7 +130,7 @@ public class Enemy extends DestructibleEntity{ } void updateShooting(){ - if(Timers.get(this, "reload", reload * Vars.multiplier)){ + if(timer.get(timerReload, reload * Vars.multiplier)){ shoot(bullet); if(shootsound != null) Effects.sound(shootsound, this); } diff --git a/core/src/io/anuke/mindustry/io/SaveIO.java b/core/src/io/anuke/mindustry/io/SaveIO.java index 2ab2a75709..83f7494cdf 100644 --- a/core/src/io/anuke/mindustry/io/SaveIO.java +++ b/core/src/io/anuke/mindustry/io/SaveIO.java @@ -269,7 +269,7 @@ public class SaveIO{ for(Item item : tile.entity.items.keys()){ stream.writeByte(item.ordinal()); //item ID - stream.writeInt(tile.entity.items.get(item)); //item amount + stream.writeInt(tile.entity.items.get(item, 0)); //item amount } tile.entity.write(stream); diff --git a/core/src/io/anuke/mindustry/ui/SaveDialog.java b/core/src/io/anuke/mindustry/ui/SaveDialog.java index 64140e40ed..fd9fa40e5e 100644 --- a/core/src/io/anuke/mindustry/ui/SaveDialog.java +++ b/core/src/io/anuke/mindustry/ui/SaveDialog.java @@ -37,7 +37,7 @@ public class SaveDialog extends LoadDialog{ } void save(int slot){ - Vars.ui.showLoading("[orange]Saving..."); + Vars.ui.showLoading("[accent]Saving..."); Timers.runTask(5f, () -> { hide(); diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index fd2522d2ce..6b671aa7e7 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -10,6 +10,7 @@ import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.GameState; import io.anuke.mindustry.core.GameState.State; +import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.GameMode; @@ -141,6 +142,8 @@ public class HudFragment implements Fragment{ new table(){{ abottom(); aleft(); + new label((StringSupplier)()->"[purple]tiles: " + Entities.getGroup(TileEntity.class).amount()).left(); + row(); new label((StringSupplier)()->"[purple]enemies: " + Entities.getGroup(Enemy.class).amount()).left(); row(); new label((StringSupplier)()->"[orange]noclip: " + Vars.noclip).left(); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 01ecec44fb..e5bf6f83cb 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -69,6 +69,8 @@ public class Block{ public String fullDescription; /**Whether to draw this block in the expanded draw range.*/ public boolean expanded = false; + /**Max of timers used.*/ + public int timers = 0; public Block(String name) { blocks.add(this); @@ -201,7 +203,6 @@ public class Block{ Tile other = tile.getNearby()[tile.getRotation()]; if(other != null && other.block().acceptItem(item, other, tile)){ other.block().handleItem(item, other, tile); - //other.entity.addCovey(item, ch == 1 ? 0.5f : ch ==2 ? 1f : 0f); return true; } return false; diff --git a/core/src/io/anuke/mindustry/world/Generator.java b/core/src/io/anuke/mindustry/world/Generator.java index 6368a8e597..49b507fa66 100644 --- a/core/src/io/anuke/mindustry/world/Generator.java +++ b/core/src/io/anuke/mindustry/world/Generator.java @@ -2,17 +2,20 @@ package io.anuke.mindustry.world; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.ObjectMap; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.enemies.TargetEnemy; -import io.anuke.mindustry.world.blocks.Blocks; +import io.anuke.mindustry.world.blocks.*; import io.anuke.mindustry.world.blocks.types.Floor; import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.noise.Noise; import io.anuke.ucore.util.Mathf; public class Generator{ + public static boolean debugBlockspam = false; + static final int spawn = Color.rgba8888(Color.RED); static final int start = Color.rgba8888(Color.GREEN); @@ -117,9 +120,9 @@ public class Generator{ } //preformance debugging - //if(Vector2.dst(pixmap.getWidth()/2, pixmap.getHeight()/2, x, y) < 30){ - // block = Mathf.choose(ProductionBlocks.stonedrill, DistributionBlocks.conveyor); - //} + if(debugBlockspam && Vector2.dst(0, 0, x, y) < 260){ + block = Mathf.choose(ProductionBlocks.omnidrill, DistributionBlocks.conveyor, DistributionBlocks.router, WeaponBlocks.turret); + } tiles[x][y].setBlock(block, 0); tiles[x][y].setFloor(floor); diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index 93cf5588a4..d81e92fdfd 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks; import io.anuke.mindustry.Vars; +import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.effect.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Liquid; @@ -8,7 +9,6 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.production.*; import io.anuke.ucore.core.Effects; -import io.anuke.ucore.core.Timers; public class ProductionBlocks{ public static final Block @@ -192,6 +192,9 @@ public class ProductionBlocks{ omnidrill = new Drill("omnidrill"){ { + drillEffect = Fx.sparkbig; + resource = null; + result = null; time = 3; formalName = "omnidrill"; description = "Mines 1 of any resource every "+time+" seconds."; @@ -200,13 +203,14 @@ public class ProductionBlocks{ @Override public void update(Tile tile){ + TileEntity entity = tile.entity; - if(tile.floor().drops != null && Timers.get(tile, "drill", 60 * time)){ + if(tile.floor().drops != null && entity.timer.get(timerDrill, 60 * time)){ offloadNear(tile, tile.floor().drops.item); - Effects.effect(Fx.sparkbig, tile.worldx(), tile.worldy()); + Effects.effect(drillEffect, tile.worldx(), tile.worldy()); } - if(Timers.get(tile, "dump", 30)){ + if(entity.timer.get(timerDump, 30)){ tryDump(tile); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java index 346abac2b9..941464de7f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/LiquidBlock.java @@ -11,10 +11,11 @@ import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; public class LiquidBlock extends Block implements LiquidAcceptor{ + protected final int timerFlow = timers++; + protected float liquidCapacity = 10f; protected float flowfactor = 4.9f; @@ -56,7 +57,7 @@ public class LiquidBlock extends Block implements LiquidAcceptor{ public void update(Tile tile){ LiquidEntity entity = tile.entity(); - if(entity.liquidAmount > 0.01f && Timers.get(entity, "flow", 3)){ + if(entity.liquidAmount > 0.01f && entity.timer.get(timerFlow, 3)){ tryMoveLiquid(tile, tile.getNearby()[tile.getRotation()]); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java index e6d4102ff7..b90c9f9fe3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/RepairTurret.java @@ -46,7 +46,7 @@ public class RepairTurret extends PowerTurret{ entity.blockTarget = null; } - if(Timers.get(entity, "blocktarget", targetInterval)){ + if(entity.timer.get(timerTarget, targetInterval)){ entity.blockTarget = Vars.world.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true); } @@ -54,7 +54,7 @@ public class RepairTurret extends PowerTurret{ float target = entity.angleTo(entity.blockTarget); entity.rotation = Mathf.slerp(entity.rotation, target, 0.16f*Timers.delta()); - if(Timers.get(tile, "reload", reload) && Angles.angleDist(target, entity.rotation) < shootCone){ + if(entity.timer.get(timerReload, reload) && Angles.angleDist(target, entity.rotation) < shootCone){ entity.blockTarget.health++; if(entity.blockTarget.health > entity.blockTarget.health) diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java index 63fa33a35e..eadf6295c6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/Turret.java @@ -30,6 +30,9 @@ public class Turret extends Block{ static final int targetInterval = 15; static boolean drawDebug = false; + protected final int timerTarget = timers++; + protected final int timerReload = timers++; + protected float range = 50f; protected float reload = 10f; protected float inaccuracy = 0f; @@ -141,11 +144,9 @@ public class Turret extends Block{ if(hasAmmo(tile) || (Vars.debug && Vars.infiniteAmmo)){ - if(Timers.get(entity, "target", targetInterval)){ + if(entity.timer.get(timerTarget, targetInterval)){ entity.target = (Enemy)Entities.getClosest(Entities.getGroup(Enemy.class), - tile.worldx(), tile.worldy(), range, e-> - e instanceof Enemy && !((Enemy)e).isDead() - ); + tile.worldx(), tile.worldy(), range, e-> e instanceof Enemy && !((Enemy)e).isDead()); } if(entity.target != null){ @@ -157,7 +158,7 @@ public class Turret extends Block{ rotatespeed*Timers.delta()); float reload = Vars.multiplier*this.reload; - if(Angles.angleDist(entity.rotation, targetRot) < shootCone && Timers.get(tile, "reload", reload)){ + if(Angles.angleDist(entity.rotation, targetRot) < shootCone && entity.timer.get(timerReload, reload)){ if(shootsound != null) Effects.sound(shootsound, entity); shoot(tile); consumeAmmo(tile); 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 80b5e4e3b8..ce29b5b283 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 @@ -5,8 +5,10 @@ import static io.anuke.mindustry.Vars.tilesize; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.util.AbstractList; +import java.util.Collections; +import java.util.List; -import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.IntArray; @@ -76,22 +78,14 @@ public class Conveyor extends Block{ int value = entity.convey.get(i); ItemPos pos = pos1.set(value); - boolean canmove = true; - - for(int j = 0; j < entity.convey.size; j ++){ - ItemPos other = pos2.set(entity.convey.get(j)); - - if(other.y > pos.y && other.y - pos.y < 0.14 * Timers.delta()){ - canmove = false; - break; - } - } + boolean canmove = i == entity.convey.size - 1 || + !(pos2.set(entity.convey.get(i + 1)).y - pos.y < 0.135 * Timers.delta()); if(canmove){ pos.y += Math.max(speed * Timers.delta(), 1f/252f); //TODO fix precision issues? - pos.x = MathUtils.lerp(pos.x, 0, 0.06f * Timers.delta()); + pos.x = Mathf.lerpDelta(pos.x, 0, 0.06f); }else{ - pos.x = MathUtils.lerp(pos.x, pos.seed/128f/3f, 0.1f * Timers.delta()); + pos.x = Mathf.lerpDelta(pos.x, pos.seed/128f/3f, 0.1f); } pos.y = Mathf.clamp(pos.y); @@ -135,7 +129,21 @@ public class Conveyor extends Block{ float y = (ang == -1 || ang == 3) ? 1 : (ang == 1 || ang == -3) ? -1 : 0; ConveyorEntity entity = tile.entity(); - entity.convey.add(ItemPos.packItem(item, y*0.9f, pos, (byte)Mathf.random(255))); + int result = ItemPos.packItem(item, y*0.9f, pos, (byte)Mathf.random(255)); + boolean inserted = false; + + for(int i = 0; i < entity.convey.size; i ++){ + if(compareItems(result, entity.convey.get(i)) < 0){ + entity.convey.insert(i, result); + inserted = true; + break; + } + } + + //this item must be greater than anything there... + if(!inserted){ + entity.convey.add(result); + } } /** @@ -167,9 +175,41 @@ public class Conveyor extends Block{ for(int i = 0; i < amount; i ++){ convey.add(stream.readInt()); } + + sort(convey.items, convey.size); } } + private static void sort(int[] elements, int length){ + List wrapper = new AbstractList() { + + @Override + public Integer get(int index) { + return elements[index]; + } + + @Override + public int size() { + return length; + } + + @Override + public Integer set(int index, Integer element) { + int v = elements[index]; + elements[index] = element; + return v; + } + }; + + Collections.sort(wrapper, Conveyor::compareItems); + } + + private static int compareItems(int a, int b){ + pos1.set(a); + pos2.set(b); + return Float.compare(pos1.y, pos2.y); + } + //Container class. Do not instantiate. static class ItemPos{ Item item; diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidRouter.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidRouter.java index df8079c55c..9e5d6af22f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidRouter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/LiquidRouter.java @@ -6,9 +6,10 @@ import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.LiquidBlock; import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Timers; public class LiquidRouter extends LiquidBlock{ + protected final int timerDump = timers++; + private ObjectMap lastmap = new ObjectMap<>(); public LiquidRouter(String name) { @@ -21,7 +22,7 @@ public class LiquidRouter extends LiquidBlock{ public void update(Tile tile){ LiquidEntity entity = tile.entity(); - if(Timers.get(tile, "dump", 2) && entity.liquidAmount > 0){ + if(entity.timer.get(timerDump, 2) && entity.liquidAmount > 0){ if(lastmap.get(tile, (byte)-1) != tile.getRotation()){ tryMoveLiquid(tile, tile.getNearby()[tile.getRotation()]); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java index 5e2f665640..fda6ce503d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/PowerBooster.java @@ -8,28 +8,29 @@ import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.PowerAcceptor; import io.anuke.mindustry.world.blocks.types.production.Generator; import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; public class PowerBooster extends Generator{ - public int powerRange = 4; + protected final int timerGenerate = timers++; + public int powerRange = 4; + public PowerBooster(String name) { super(name); explosive = false; hasLasers = false; powerSpeed = 0.4f; } - + @Override public void drawPixelOverlay(Tile tile){ super.drawPixelOverlay(tile); - + Draw.color("yellow"); Draw.dashCircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize); Draw.reset(); } - + @Override public void drawPlace(int x, int y, int rotation, boolean valid){ Draw.color("purple"); @@ -37,69 +38,70 @@ public class PowerBooster extends Generator{ Draw.dashCircle(x * Vars.tilesize, y * Vars.tilesize, powerRange * Vars.tilesize); Draw.reset(); } - + @Override public void getStats(Array list){ super.getStats(list); list.add("[powerinfo]Power Range: " + powerRange + " tiles"); } - + @Override public void update(Tile tile){ distributePower(tile); } - + @Override - public void drawOver(Tile tile){} - + public void drawOver(Tile tile){ + } + @Override public boolean acceptsPower(Tile tile){ PowerEntity entity = tile.entity(); - + return entity.power + 0.001f <= powerCapacity; } - + //TODO better distribution - protected void distributePower(Tile tile){ - if(!Timers.get(tile, "generate", powerTime)){ - return; - } + protected void distributePower(Tile tile){ + PowerEntity p = tile.entity(); + + if(!p.timer.get(timerGenerate, powerTime)){ + return; + } - PowerEntity p = tile.entity(); + int acceptors = 0; + float flow = 0f; - int acceptors = 0; - float flow = 0f; + for(int i = 0; i < 2; i++){ + for(int x = -powerRange; x <= powerRange; x++){ + for(int y = -powerRange; y <= powerRange; y++){ - for(int i = 0; i < 2; i++){ - for(int x = -powerRange; x <= powerRange; x++){ - for(int y = -powerRange; y <= powerRange; y++){ + if(x == 0 && y == 0){ + continue; + } - if(x == 0 && y == 0){ - continue; - } + if(Vector2.dst(x, y, 0, 0) < powerRange){ + Tile dest = Vars.world.tile(tile.x + x, tile.y + y); + if(dest != null && dest.block() instanceof PowerAcceptor && ((PowerAcceptor) dest.block()).acceptsPower(dest)){ + if(i == 1){ + PowerAcceptor block = (PowerAcceptor) dest.block(); - if(Vector2.dst(x, y, 0, 0) < powerRange){ - Tile dest = Vars.world.tile(tile.x + x, tile.y + y); - if(dest != null && dest.block() instanceof PowerAcceptor && ((PowerAcceptor) dest.block()).acceptsPower(dest)){ - if(i == 1){ - PowerAcceptor block = (PowerAcceptor) dest.block(); + float transmission = Math.min(flow, p.power); - float transmission = Math.min(flow, p.power); - - float amount = block.addPower(dest, transmission); - p.power -= amount; - }else{ - acceptors++; - } + float amount = block.addPower(dest, transmission); + p.power -= amount; + }else{ + acceptors++; } } } } + } - //TODO better distribution scheme - if(i == 0 && acceptors > 0){ - flow = Mathf.clamp(p.power / acceptors, 0f, powerSpeed / acceptors); - } + //TODO better distribution scheme + if(i == 0 && acceptors > 0){ + flow = Mathf.clamp(p.power / acceptors, 0f, powerSpeed / acceptors); } } + } } 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 baa43f5e1e..f745f420f5 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 @@ -8,10 +8,11 @@ import io.anuke.mindustry.Vars; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; -import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; public class Router extends Block{ + protected final int timerDump = timers++; + private ObjectMap lastmap = new ObjectMap<>(); int capacity = 20; @@ -34,7 +35,7 @@ public class Router extends Block{ @Override public void update(Tile tile){ - if(Timers.get(tile, "dump", 2) && tile.entity.totalItems() > 0){ + if(tile.entity.timer.get(timerDump, 2) && tile.entity.totalItems() > 0){ if(lastmap.get(tile, (byte)-1) != tile.getRotation() || Mathf.chance(0.3)){ //sometimes dump backwards at a 1/4 chance... this somehow works? tryDump(tile, tile.getRotation(), null); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java index 09b398af2d..4c4411bb44 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Crafter.java @@ -9,9 +9,10 @@ import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Effects; -import io.anuke.ucore.core.Timers; public class Crafter extends Block{ + protected final int timerDump = timers++; + protected Item[] requirements; protected Item result; @@ -31,7 +32,7 @@ public class Crafter extends Block{ @Override public void update(Tile tile){ - if(Timers.get(tile, "dump", 20) && tile.entity.hasItem(result)){ + if(tile.entity.timer.get(timerDump, 20) && tile.entity.hasItem(result)){ tryDump(tile, -1, result); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java index 05225780bf..78701e63f6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java @@ -2,20 +2,26 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.effect.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; +import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Mathf; public class Drill extends Block{ + protected final int timerDrill = timers++; + protected final int timerDump = timers++; + protected Block resource; protected Item result; protected int time = 5; protected int capacity = 5; + protected Effect drillEffect = Fx.spark; public Drill(String name) { super(name); @@ -32,13 +38,15 @@ public class Drill extends Block{ @Override public void update(Tile tile){ + TileEntity entity = tile.entity; - if((tile.floor() == resource || (resource.drops.equals(tile.floor().drops))) && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < capacity){ + if((tile.floor() == resource || (resource.drops.equals(tile.floor().drops))) + && entity.timer.get(timerDrill, 60 * time) && tile.entity.totalItems() < capacity){ offloadNear(tile, result); - Effects.effect(Fx.spark, tile.worldx(), tile.worldy()); + Effects.effect(drillEffect, tile.worldx(), tile.worldy()); } - if(Timers.get(tile, "dump", 30)){ + if(entity.timer.get(timerDump, 30)){ tryDump(tile); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java index ddc31fed50..703c745360 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Generator.java @@ -184,9 +184,19 @@ public class Generator extends PowerBlock{ } float r = interfering ? 0.8f : 0f; - - Draw.laser("laser", "laserend", tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), target.worldx() - Tmp.v1.x + Mathf.range(r), target.worldy() - Tmp.v1.y + Mathf.range(r), 0.7f + Mathf.sin(Timers.time(), 2f, 0.1f * 0)); - + + int relative = tile.relativeTo(target.x, target.y); + + if(relative == -1){ + Draw.laser("laser", "laserend", tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), + target.worldx() - Tmp.v1.x + Mathf.range(r), + target.worldy() - Tmp.v1.y + Mathf.range(r), 0.7f); + }else{ + Draw.rect("laserfull", + tile.worldx() + Geometry.getD4Points()[relative].x * width * Vars.tilesize / 2f, + tile.worldy() + Geometry.getD4Points()[relative].y * width * Vars.tilesize / 2f); + } + Draw.color(); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java index 49f8e7e14b..725abd888f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidCrafter.java @@ -13,10 +13,12 @@ import io.anuke.mindustry.world.blocks.types.LiquidBlock; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects.Effect; -import io.anuke.ucore.core.Timers; import io.anuke.ucore.util.Strings; public class LiquidCrafter extends LiquidBlock{ + protected final int timerDump = timers++; + protected final int timerPurify = timers++; + /**Can be null.*/ public Item input = null; public int inputAmount = 5; @@ -63,7 +65,7 @@ public class LiquidCrafter extends LiquidBlock{ public void update(Tile tile){ LiquidEntity entity = tile.entity(); - if(Timers.get(tile, "purify", purifyTime) && entity.liquidAmount >= liquidAmount && + if(entity.timer.get(timerPurify, purifyTime) && entity.liquidAmount >= liquidAmount && (input == null || entity.hasItem(input, inputAmount))){ if(input != null) @@ -73,7 +75,7 @@ public class LiquidCrafter extends LiquidBlock{ Effects.effect(craftEffect, tile.worldx(), tile.worldy()); } - if(Timers.get(tile.hashCode(), "dump", 30)){ + if(entity.timer.get(timerDump, 30)){ tryDump(tile, -1, output); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java index a238c91d1a..9d477825c1 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/NuclearReactor.java @@ -21,6 +21,8 @@ import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Tmp; public class NuclearReactor extends LiquidItemPowerGenerator{ + protected final int timerFuel = timers++; + protected Color coolColor = new Color(1, 1, 1, 0f); protected Color hotColor = Color.valueOf("ff9575a3"); protected int fuelUseTime = 120; //time to consume 1 fuel @@ -53,7 +55,7 @@ public class NuclearReactor extends LiquidItemPowerGenerator{ if(fuel > 0){ entity.heat += fullness * heating; entity.power += powerMultiplier * fullness; - if(Timers.get(tile, "fuelRemove", fuelUseTime)){ + if(entity.timer.get(timerFuel, fuelUseTime)){ entity.removeItem(generateItem, 1); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java index 9268933293..ab90aef137 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java @@ -11,6 +11,9 @@ import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Strings; public class Pump extends LiquidBlock{ + protected final int timerPump = timers++; + protected final int timerDump = timers++; + protected float pumpAmount = 2f; protected float pumpTime = 8f; @@ -59,12 +62,12 @@ public class Pump extends LiquidBlock{ LiquidEntity entity = tile.entity(); if(tile.floor().liquidDrop != null && - Timers.get(tile, "pump", pumpTime) && entity.liquidAmount < liquidCapacity){ + entity.timer.get(timerPump, pumpTime) && entity.liquidAmount < liquidCapacity){ entity.liquid = tile.floor().liquidDrop; entity.liquidAmount += Math.min(pumpAmount, this.liquidCapacity - entity.liquidAmount); } - if(Timers.get(tile, "dump", 1)){ + if(entity.timer.get(timerDump, pumpTime)){ tryDumpLiquid(tile); } }