diff --git a/build.gradle b/build.gradle index 8072bd94a8..9fc594f5f5 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.anuken:ucore:ea3563b5e4' + compile 'com.github.anuken:ucore:e8865d2b26' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/assets-raw/sprites/blocks/block-2x2.png b/core/assets-raw/sprites/blocks/block-2x2.png index b257fe47ab..e8651c2bd8 100644 Binary files a/core/assets-raw/sprites/blocks/block-2x2.png and b/core/assets-raw/sprites/blocks/block-2x2.png differ diff --git a/core/assets-raw/sprites/chainbullet.png b/core/assets-raw/sprites/chainbullet.png new file mode 100644 index 0000000000..aaf1228374 Binary files /dev/null and b/core/assets-raw/sprites/chainbullet.png differ diff --git a/core/assets-raw/sprites/shell.png b/core/assets-raw/sprites/shell.png new file mode 100644 index 0000000000..747f735e65 Binary files /dev/null and b/core/assets-raw/sprites/shell.png differ diff --git a/core/assets-raw/sprites/titanshell.png b/core/assets-raw/sprites/titanshell.png new file mode 100644 index 0000000000..7f90039999 Binary files /dev/null and b/core/assets-raw/sprites/titanshell.png differ diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index e5969a0be7..f526adfc48 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -13,7 +13,7 @@ backgrounds/background index: -1 blank rotate: false - xy: 395, 231 + xy: 379, 256 size: 1, 1 orig: 1, 1 offset: 0, 0 @@ -55,98 +55,98 @@ blocks/chainturret-icon index: -1 blocks/coal1 rotate: false - xy: 502, 493 + xy: 498, 424 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal2 rotate: false - xy: 498, 423 + xy: 395, 234 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coal3 rotate: false - xy: 395, 234 + xy: 432, 424 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coaldrill rotate: false - xy: 432, 424 + xy: 276, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalgenerator rotate: false - xy: 276, 119 + xy: 286, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/coalpurifier rotate: false - xy: 286, 119 + xy: 296, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/combustiongenerator rotate: false - xy: 296, 119 + xy: 306, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/compositewall rotate: false - xy: 306, 119 + xy: 316, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduit rotate: false - xy: 316, 119 + xy: 326, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitbottom rotate: false - xy: 326, 119 + xy: 336, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduitliquid rotate: false - xy: 336, 119 + xy: 346, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conduittop rotate: false - xy: 346, 116 + xy: 356, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyor rotate: false - xy: 356, 116 + xy: 366, 116 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/conveyormove rotate: false - xy: 366, 116 + xy: 474, 415 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -160,14 +160,14 @@ blocks/core index: -1 blocks/cross rotate: false - xy: 474, 415 + xy: 484, 415 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/crucible rotate: false - xy: 484, 415 + xy: 494, 414 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -181,28 +181,28 @@ blocks/deepwater index: -1 blocks/dirt1 rotate: false - xy: 494, 413 + xy: 228, 22 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt2 rotate: false - xy: 228, 22 + xy: 228, 12 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirt3 rotate: false - xy: 228, 12 + xy: 226, 2 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/dirtblock rotate: false - xy: 226, 2 + xy: 375, 192 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -223,14 +223,14 @@ blocks/doubleturret index: -1 blocks/drill rotate: false - xy: 375, 192 + xy: 375, 182 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/duriumwall rotate: false - xy: 375, 182 + xy: 373, 172 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -244,7 +244,7 @@ blocks/duriumwall-large index: -1 blocks/duriumwall-large-icon rotate: false - xy: 373, 172 + xy: 385, 230 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -258,35 +258,35 @@ blocks/flameturret index: -1 blocks/grass1 rotate: false - xy: 388, 221 + xy: 395, 215 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass2 rotate: false - xy: 398, 224 + xy: 385, 210 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grass3 rotate: false - xy: 405, 234 + xy: 395, 205 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock rotate: false - xy: 408, 224 + xy: 385, 200 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/grassblock2 rotate: false - xy: 398, 214 + xy: 385, 190 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -300,42 +300,42 @@ blocks/grassedge index: -1 blocks/iron1 rotate: false - xy: 401, 298 + xy: 390, 160 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron2 rotate: false - xy: 401, 288 + xy: 390, 150 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/iron3 rotate: false - xy: 401, 278 + xy: 401, 358 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/irondrill rotate: false - xy: 401, 268 + xy: 401, 348 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/ironwall rotate: false - xy: 401, 258 + xy: 401, 338 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/junction rotate: false - xy: 411, 360 + xy: 401, 328 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -349,7 +349,7 @@ blocks/laserturret index: -1 blocks/lava rotate: false - xy: 411, 350 + xy: 401, 318 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -363,21 +363,21 @@ blocks/lavaedge index: -1 blocks/liquiditemjunction rotate: false - xy: 411, 340 + xy: 401, 308 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidjunction rotate: false - xy: 411, 330 + xy: 401, 298 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/liquidrouter rotate: false - xy: 411, 320 + xy: 401, 288 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -405,14 +405,14 @@ blocks/mortarturret index: -1 blocks/mossblock rotate: false - xy: 411, 300 + xy: 401, 268 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/mossstone rotate: false - xy: 411, 300 + xy: 401, 268 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -426,7 +426,7 @@ blocks/nuclearreactor index: -1 blocks/nuclearreactor-icon rotate: false - xy: 411, 280 + xy: 411, 360 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -440,7 +440,7 @@ blocks/nuclearreactor-small index: -1 blocks/oil rotate: false - xy: 411, 270 + xy: 411, 350 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -454,14 +454,14 @@ blocks/oiledge index: -1 blocks/oilrefinery rotate: false - xy: 411, 260 + xy: 411, 340 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/omnidrill rotate: false - xy: 230, 119 + xy: 411, 330 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -475,42 +475,42 @@ blocks/plasmaturret index: -1 blocks/powerbooster rotate: false - xy: 230, 109 + xy: 411, 320 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyor rotate: false - xy: 240, 119 + xy: 411, 310 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/poweredconveyormove rotate: false - xy: 230, 99 + xy: 411, 300 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaser rotate: false - xy: 240, 109 + xy: 411, 290 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/powerlaserrouter rotate: false - xy: 230, 89 + xy: 411, 280 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/pump rotate: false - xy: 240, 99 + xy: 411, 270 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -524,35 +524,35 @@ blocks/repairturret index: -1 blocks/rock rotate: false - xy: 240, 89 + xy: 405, 234 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2 rotate: false - xy: 230, 69 + xy: 405, 224 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rock2shadow rotate: false - xy: 240, 79 + xy: 405, 214 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/rockshadow rotate: false - xy: 230, 59 + xy: 405, 204 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/router rotate: false - xy: 240, 69 + xy: 405, 194 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -566,70 +566,70 @@ blocks/shadow index: -1 blocks/shieldgenerator rotate: false - xy: 230, 49 + xy: 405, 174 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shotgunturret rotate: false - xy: 498, 481 + xy: 498, 482 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/shrub rotate: false - xy: 240, 49 + xy: 240, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/shrubshadow rotate: false - xy: 240, 39 + xy: 230, 99 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/smelter rotate: false - xy: 250, 115 + xy: 240, 109 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/sniperturret rotate: false - xy: 498, 469 + xy: 498, 470 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/sorter rotate: false - xy: 260, 115 + xy: 230, 89 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyor rotate: false - xy: 250, 105 + xy: 240, 99 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelconveyormove rotate: false - xy: 250, 95 + xy: 230, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/steelwall rotate: false - xy: 260, 105 + xy: 240, 89 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -643,49 +643,49 @@ blocks/stone index: -1 blocks/stone1 rotate: false - xy: 250, 85 + xy: 230, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone2 rotate: false - xy: 260, 95 + xy: 240, 79 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stone3 rotate: false - xy: 250, 75 + xy: 230, 59 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock rotate: false - xy: 260, 85 + xy: 240, 69 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock2 rotate: false - xy: 250, 65 + xy: 230, 49 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stoneblock3 rotate: false - xy: 260, 75 + xy: 240, 59 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/stonedrill rotate: false - xy: 250, 55 + xy: 230, 39 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -699,28 +699,28 @@ blocks/stoneedge index: -1 blocks/stonewall rotate: false - xy: 260, 65 + xy: 240, 49 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter rotate: false - xy: 250, 45 + xy: 240, 39 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/teleporter-top rotate: false - xy: 260, 55 + xy: 250, 115 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/thermalgenerator rotate: false - xy: 260, 45 + xy: 260, 115 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -734,56 +734,56 @@ blocks/titancannon index: -1 blocks/titancannon-icon rotate: false - xy: 498, 457 + xy: 498, 458 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/titanium1 rotate: false - xy: 250, 35 + xy: 250, 105 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium2 rotate: false - xy: 260, 35 + xy: 250, 95 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titanium3 rotate: false - xy: 270, 109 + xy: 260, 105 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumdrill rotate: false - xy: 270, 99 + xy: 250, 85 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumpurifier rotate: false - xy: 280, 109 + xy: 260, 95 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumshieldwall rotate: false - xy: 270, 89 + xy: 250, 75 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/titaniumwall rotate: false - xy: 280, 99 + xy: 260, 85 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -797,49 +797,49 @@ blocks/titaniumwall-large index: -1 blocks/titaniumwall-large-icon rotate: false - xy: 290, 109 + xy: 250, 65 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/turret rotate: false - xy: 498, 445 + xy: 498, 446 size: 10, 10 orig: 10, 10 offset: 0, 0 index: -1 blocks/uranium1 rotate: false - xy: 280, 89 + xy: 260, 65 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium2 rotate: false - xy: 290, 99 + xy: 250, 45 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uranium3 rotate: false - xy: 300, 109 + xy: 260, 55 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/uraniumdrill rotate: false - xy: 270, 69 + xy: 260, 45 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 blocks/water rotate: false - xy: 280, 79 + xy: 250, 35 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -853,7 +853,7 @@ blocks/wateredge index: -1 blocks/waveturret rotate: false - xy: 498, 433 + xy: 498, 434 size: 10, 10 orig: 10, 10 offset: 0, 0 @@ -865,6 +865,13 @@ bullet orig: 8, 8 offset: 0, 0 index: -1 +chainbullet + rotate: false + xy: 502, 494 + size: 8, 7 + orig: 8, 7 + offset: 0, 0 + index: -1 circle rotate: false xy: 359, 220 @@ -1098,56 +1105,56 @@ enemies/titanenemy-t3 index: -1 enemyarrow rotate: false - xy: 385, 231 + xy: 395, 225 size: 8, 7 orig: 8, 7 offset: 0, 0 index: -1 icon-coal rotate: false - xy: 408, 214 + xy: 395, 195 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-dirium rotate: false - xy: 401, 358 + xy: 385, 180 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-iron rotate: false - xy: 401, 348 + xy: 395, 185 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-steel rotate: false - xy: 401, 338 + xy: 383, 170 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-stone rotate: false - xy: 401, 328 + xy: 380, 160 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-titanium rotate: false - xy: 401, 318 + xy: 380, 150 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 icon-uranium rotate: false - xy: 401, 308 + xy: 395, 175 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1173,16 +1180,30 @@ mechs/player orig: 12, 12 offset: 0, 0 index: -1 +shell + rotate: false + xy: 405, 184 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 shot rotate: false - xy: 240, 59 + xy: 230, 119 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 shot-long rotate: false - xy: 230, 39 + xy: 230, 109 + size: 8, 8 + orig: 8, 8 + offset: 0, 0 + index: -1 +titanshell + rotate: false + xy: 260, 75 size: 8, 8 orig: 8, 8 offset: 0, 0 @@ -1534,14 +1555,14 @@ ui/scroll-knob-vertical index: -1 ui/selection rotate: false - xy: 379, 256 + xy: 382, 256 size: 1, 1 orig: 1, 1 offset: 0, 0 index: -1 ui/separator rotate: false - xy: 382, 256 + xy: 350, 170 size: 1, 1 orig: 1, 1 offset: 0, 0 @@ -1629,35 +1650,35 @@ weapons/blaster index: -1 weapons/flamer rotate: false - xy: 378, 221 + xy: 385, 220 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/mortar rotate: false - xy: 411, 310 + xy: 401, 278 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/multigun rotate: false - xy: 411, 290 + xy: 401, 258 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/railgun rotate: false - xy: 230, 79 + xy: 411, 260 size: 8, 8 orig: 8, 8 offset: 0, 0 index: -1 weapons/triblaster rotate: false - xy: 270, 79 + xy: 250, 55 size: 8, 8 orig: 8, 8 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 8e09d1348e..ec1a0b28ce 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index 7937eafecc..d7cf48a26d 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -56,6 +56,8 @@ public class Control extends Module{ UCore.log("Total blocks loaded: " + Block.getAllBlocks().size); + Draw.setCircleVertices(14); + Gdx.input.setCatchBackKey(true); if(android){ @@ -237,14 +239,15 @@ public class Control extends Module{ for(int i = 0; i < spawnamount; i ++){ int index = i; + float range = 8f; Timers.run(index*50f, ()->{ try{ Constructor c = ClassReflection.getConstructor(spawn.type, int.class); Enemy enemy = (Enemy)c.newInstance(fl); - enemy.set(tile.worldx(), tile.worldy()); + enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range)); enemy.tier = spawn.tier(wave, fl); - Effects.effect("spawn", enemy); + Effects.effect(Fx.spawn, enemy); enemy.add(); enemies ++; @@ -294,10 +297,10 @@ public class Control extends Module{ Tile core = World.core; for(int i = 0; i < 16; i ++){ Timers.run(i*2, ()->{ - Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40)); + Effects.effect(Fx.explosion, core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40)); }); } - Effects.effect("coreexplosion", core.worldx(), core.worldy()); + Effects.effect(Fx.coreexplosion, core.worldx(), core.worldy()); Timers.run(60, ()->{ ui.showRestart(); @@ -393,8 +396,6 @@ public class Control extends Module{ Entities.setCollider(tilesize, (x, y)->{ return World.solid(x, y); }); - - EffectCreator.create(); } @Override @@ -402,7 +403,8 @@ public class Control extends Module{ if(debug){ if(Inputs.keyUp(Keys.P)){ - Effects.effect("blockexplosion", player); + Effects.effect(Fx.shellsmoke, player); + Effects.effect(Fx.shellexplosion, player); } if(Inputs.keyUp(Keys.C)){ diff --git a/core/src/io/anuke/mindustry/EffectCreator.java b/core/src/io/anuke/mindustry/EffectCreator.java deleted file mode 100644 index c24be63794..0000000000 --- a/core/src/io/anuke/mindustry/EffectCreator.java +++ /dev/null @@ -1,301 +0,0 @@ -package io.anuke.mindustry; - -import static io.anuke.mindustry.Vars.respawnduration; - -import com.badlogic.gdx.graphics.Color; - -import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Effects; -import io.anuke.ucore.graphics.Hue; -import io.anuke.ucore.util.Angles; -import io.anuke.ucore.util.Mathf; - -public class EffectCreator{ - static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f); - static Color lightOrange = Color.valueOf("f68021"); - - public static void create(){ - - Effects.create("generatorexplosion", 28, 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()); - Draw.rect("circle", e.x + x, e.y + y, size, size); - Draw.reset(); - }); - }); - - Effects.create("chainshot", 9f, e -> { - Draw.color(Color.WHITE, lightOrange, e.ifract()); - Draw.thick(e.fract()*4f); - Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*7f); - Draw.thick(e.fract()*2f); - Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*10f); - Draw.reset(); - }); - - Effects.create("shockwave", 10f, 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(); - }); - - Effects.create("empshockwave", 7f, e -> { - Draw.color(Color.WHITE, Color.SKY, e.ifract()); - Draw.thick(e.fract()*2f); - Draw.circle(e.x, e.y, e.ifract()*40f); - Draw.reset(); - }); - - Effects.create("empspark", 13, e -> { - Angles.randLenVectors(e.id, 7, 1f + e.ifract()*12f, (x, y)->{ - float len = 1f+e.fract()*6f; - Draw.color(Color.SKY); - Draw.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len); - Draw.reset(); - }); - }); - - Effects.create("shellsmoke", 21, e -> { - Angles.randLenVectors(e.id, 8, 1f + e.ifract()*16f, (x, y)->{ - float size = 2f+e.fract()*5f; - Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); - Draw.rect("circle", e.x + x, e.y + y, size, size); - Draw.reset(); - }); - }); - - Effects.create("blastsmoke", 26, e -> { - Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{ - float size = 2f+e.fract()*6f; - Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); - Draw.rect("circle", e.x + x, e.y + y, size, size); - Draw.reset(); - }); - }); - - Effects.create("lava", 18, e -> { - Angles.randLenVectors(e.id, 3, 1f + e.ifract()*10f, (x, y)->{ - float size = e.sfract()*4f; - Draw.color(Color.ORANGE, Color.GRAY, e.ifract()); - Draw.rect("circle", e.x + x, e.y + y, size, size); - Draw.reset(); - }); - }); - - Effects.create("lavabubble", 45f, e -> { - Draw.color(Color.ORANGE); - float scl = 0.35f; - Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl)); - Draw.circle(e.x, e.y, e.ifract()*4f); - Draw.reset(); - }); - - Effects.create("oilbubble", 64f, e -> { - Draw.color(Color.DARK_GRAY); - float scl = 0.25f; - Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl)); - Draw.circle(e.x, e.y, e.ifract()*3f); - Draw.reset(); - }); - - Effects.create("shellexplosion", 15, e -> { - Draw.thickness(1.3f - e.ifract()); - Draw.color(Color.WHITE, Color.ORANGE, e.ifract()); - Draw.circle(e.x, e.y, 1f + e.ifract() * 7f); - Draw.reset(); - }); - - Effects.create("blastexplosion", 16, e -> { - Draw.thickness(1.2f - e.ifract()); - Draw.color(Color.WHITE, Color.SCARLET, e.ifract()); - Draw.circle(e.x, e.y, 1.5f + e.ifract() * 9f); - Draw.reset(); - }); - - Effects.create("place", 16, e -> { - Draw.thickness(3f - e.ifract() * 2f); - Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f); - Draw.reset(); - }); - - Effects.create("purify", 10, e -> { - Draw.color(Color.ROYAL, Color.GRAY, e.ifract()); - Draw.thickness(2f); - Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); - Draw.reset(); - }); - - Effects.create("purifyoil", 10, e -> { - Draw.color(Color.BLACK, Color.GRAY, e.ifract()); - Draw.thickness(2f); - Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); - Draw.reset(); - }); - - Effects.create("generate", 11, e -> { - Draw.color(Color.ORANGE, Color.YELLOW, e.ifract()); - Draw.thickness(1f); - Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); - Draw.reset(); - }); - - Effects.create("spark", 10, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.GRAY, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); - Draw.reset(); - }); - - Effects.create("sparkbig", 11, e -> { - Draw.thickness(1f); - Draw.color(lightRed, Color.GRAY, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8); - Draw.reset(); - }); - - Effects.create("smelt", 10, e -> { - Draw.thickness(1f); - Draw.color(Color.YELLOW, Color.RED, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); - Draw.reset(); - }); - - Effects.create("break", 12, e -> { - Draw.thickness(2f); - Draw.color(Color.WHITE, Color.GRAY, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 5); - Draw.reset(); - }); - - Effects.create("hit", 10, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.ORANGE, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8); - Draw.reset(); - }); - - Effects.create("laserhit", 10, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.SKY, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 6); - Draw.reset(); - }); - - Effects.create("shoot", 8, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.GOLD, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5); - Draw.reset(); - }); - - Effects.create("shoot2", 8, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.SKY, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); - Draw.reset(); - }); - - Effects.create("shoot3", 8, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.GOLD, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); - Draw.reset(); - }); - - Effects.create("railshoot", 8, e -> { - Draw.thickness(2f - e.ifract()*2f); - Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); - Draw.spikes(e.x, e.y, 1f + e.ifract() * 4f, 1, 5); - Draw.reset(); - }); - - Effects.create("mortarshoot", 9, e -> { - Draw.thickness(1.3f - e.ifract()); - Draw.color(Color.WHITE, Color.ORANGE, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); - Draw.circle(e.x, e.y, e.ifract() * 5f + 1f); - Draw.reset(); - }); - - Effects.create("explosion", 11, 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() * 6f); - - Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY); - float rad = e.fract()*10f + 5f; - Angles.randLenVectors(e.id, 5, 8f, (x, y)->{ - Draw.rect("circle2", e.x + x, e.y + y, rad, rad); - }); - - Draw.reset(); - }); - - Effects.create("blockexplosion", 13, e -> { - Angles.randLenVectors(e.id+1, 8, 5f + e.ifract()*11f, (x, y)->{ - float size = 2f+e.fract()*8f; - Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); - Draw.rect("circle", e.x + x, e.y + y, size, size); - Draw.reset(); - }); - - Draw.thickness(2f*e.fract()+0.4f); - Draw.color(Color.WHITE, Color.ORANGE, e.powfract()); - Draw.circle(e.x, e.y, 2f + e.powfract() * 9f); - - Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY); - float rad = e.fract()*10f + 2f; - Angles.randLenVectors(e.id, 5, 8f, (x, y)->{ - Draw.rect("circle2", e.x + x, e.y + y, rad, rad); - }); - - Draw.reset(); - }); - - Effects.create("coreexplosion", 13, e -> { - Draw.thickness(3f-e.ifract()*2f); - Draw.color(Color.ORANGE, Color.WHITE, e.ifract()); - Draw.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6); - Draw.circle(e.x, e.y, 4f + e.ifract() * 40f); - Draw.reset(); - }); - - Effects.create("smoke", 100, e -> { - Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.ifract()); - float size = 7f-e.ifract()*7f; - Draw.rect("circle", e.x, e.y, size, size); - Draw.reset(); - }); - - Effects.create("railsmoke", 30, e -> { - Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract()); - float size = e.fract()*4f; - Draw.rect("circle", e.x, e.y, size, size); - Draw.reset(); - }); - - Effects.create("spawn", 23, e -> { - Draw.thickness(2f); - Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract()); - Draw.circle(e.x, e.y, 7f - e.ifract() * 6f); - Draw.reset(); - }); - - Effects.create("ind", 100, e -> { - Draw.thickness(3f); - Draw.color("royal"); - Draw.circle(e.x, e.y, 3); - Draw.reset(); - }); - - Effects.create("respawn", respawnduration, e -> { - Draw.tcolor(Color.SCARLET); - Draw.tscl(0.25f); - Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y); - Draw.tscl(0.5f); - Draw.reset(); - }); - } -} diff --git a/core/src/io/anuke/mindustry/Fx.java b/core/src/io/anuke/mindustry/Fx.java new file mode 100644 index 0000000000..7e97243ccd --- /dev/null +++ b/core/src/io/anuke/mindustry/Fx.java @@ -0,0 +1,332 @@ +package io.anuke.mindustry; + +import com.badlogic.gdx.graphics.Color; + +import io.anuke.ucore.core.Draw; +import io.anuke.ucore.core.Effects.Effect; +import io.anuke.ucore.graphics.Hue; +import io.anuke.ucore.util.Angles; +import io.anuke.ucore.util.Mathf; + +public class Fx{ + static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f); + static Color lightOrange = Color.valueOf("f68021"); + static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f); + + public static final Effect + + generatorexplosion = new Effect(28, 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()); + Draw.rect("circle", e.x + x, e.y + y, size, size); + Draw.reset(); + }); + }), + + chainshot = new Effect(9f, e -> { + Draw.color(Color.WHITE, lightOrange, e.ifract()); + Draw.thick(e.fract()*4f); + Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*7f); + Draw.thick(e.fract()*2f); + Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*10f); + Draw.reset(); + }), + + titanshot = new Effect(12f, e -> { + Draw.color(Color.WHITE, lightOrange, e.ifract()); + Draw.thick(e.fract()*7f); + Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*12f); + Draw.thick(e.fract()*4f); + Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*16f); + Draw.thick(e.fract()*2f); + Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*18f); + Draw.reset(); + }), + + shockwave = new Effect(10f, 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(); + }), + + shockwaveSmall = new Effect(10f, e -> { + Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); + Draw.thick(e.fract()*2f + 0.1f); + Draw.circle(e.x, e.y, e.ifract()*15f); + Draw.reset(); + }), + + empshockwave = new Effect(7f, e -> { + Draw.color(Color.WHITE, Color.SKY, e.ifract()); + Draw.thick(e.fract()*2f); + Draw.circle(e.x, e.y, e.ifract()*40f); + Draw.reset(); + }), + + empspark = new Effect(13, e -> { + Angles.randLenVectors(e.id, 7, 1f + e.ifract()*12f, (x, y)->{ + float len = 1f+e.fract()*6f; + Draw.color(Color.SKY); + Draw.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len); + Draw.reset(); + }); + }), + + shellsmoke = new Effect(20, e -> { + Angles.randLenVectors(e.id, 8, 3f + e.ifract()*17f, (x, y)->{ + float size = 2f+e.fract()*5f; + Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); + Draw.rect("circle", e.x + x, e.y + y, size, size); + Draw.reset(); + }); + }), + + blastsmoke = new Effect(26, e -> { + Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{ + float size = 2f+e.fract()*6f; + Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); + Draw.rect("circle", e.x + x, e.y + y, size, size); + Draw.reset(); + }); + }), + + lava = new Effect(18, e -> { + Angles.randLenVectors(e.id, 3, 1f + e.ifract()*10f, (x, y)->{ + float size = e.sfract()*4f; + Draw.color(Color.ORANGE, Color.GRAY, e.ifract()); + Draw.rect("circle", e.x + x, e.y + y, size, size); + Draw.reset(); + }); + }), + + lavabubble = new Effect(45f, e -> { + Draw.color(Color.ORANGE); + float scl = 0.35f; + Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl)); + Draw.circle(e.x, e.y, e.ifract()*4f); + Draw.reset(); + }), + + oilbubble = new Effect(64f, e -> { + Draw.color(Color.DARK_GRAY); + float scl = 0.25f; + Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl)); + Draw.circle(e.x, e.y, e.ifract()*3f); + Draw.reset(); + }), + + shellexplosion = new Effect(9, e -> { + Draw.thickness(2f - e.ifract()*1.7f); + Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); + Draw.circle(e.x, e.y, 3f + e.ifract() * 9f); + Draw.reset(); + }), + + blastexplosion = new Effect(16, e -> { + Draw.thickness(1.2f - e.ifract()); + Draw.color(Color.WHITE, Color.SCARLET, e.ifract()); + Draw.circle(e.x, e.y, 1.5f + e.ifract() * 9f); + Draw.reset(); + }), + + place = new Effect(16, e -> { + Draw.thickness(3f - e.ifract() * 2f); + Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f); + Draw.reset(); + }), + + purify = new Effect(10, e -> { + Draw.color(Color.ROYAL, Color.GRAY, e.ifract()); + Draw.thickness(2f); + Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); + Draw.reset(); + }), + + purifyoil = new Effect(10, e -> { + Draw.color(Color.BLACK, Color.GRAY, e.ifract()); + Draw.thickness(2f); + Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); + Draw.reset(); + }), + + generate = new Effect(11, e -> { + Draw.color(Color.ORANGE, Color.YELLOW, e.ifract()); + Draw.thickness(1f); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); + Draw.reset(); + }), + + spark = new Effect(10, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.GRAY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); + Draw.reset(); + }), + + sparkbig = new Effect(11, e -> { + Draw.thickness(1f); + Draw.color(lightRed, Color.GRAY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8); + Draw.reset(); + }), + + smelt = new Effect(10, e -> { + Draw.thickness(1f); + Draw.color(Color.YELLOW, Color.RED, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); + Draw.reset(); + }), + + breakBlock = new Effect(12, e -> { + Draw.thickness(2f); + Draw.color(Color.WHITE, Color.GRAY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 5); + Draw.reset(); + }), + + hit = new Effect(10, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.ORANGE, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8); + Draw.reset(); + }), + + laserhit = new Effect(10, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.SKY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 6); + Draw.reset(); + }), + + shoot = new Effect(8, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.GOLD, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5); + Draw.reset(); + }), + + shoot2 = new Effect(8, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.SKY, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); + Draw.reset(); + }), + + shoot3 = new Effect(8, e -> { + Draw.thickness(1f); + Draw.color(Color.WHITE, Color.GOLD, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); + Draw.reset(); + }), + + railshoot = new Effect(8, e -> { + Draw.thickness(2f - e.ifract()*2f); + Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); + Draw.spikes(e.x, e.y, 1f + e.ifract() * 4f, 1, 5); + Draw.reset(); + }), + + mortarshoot = new Effect(9, e -> { + Draw.thickness(1.3f - e.ifract()); + Draw.color(Color.WHITE, Color.ORANGE, e.ifract()); + Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); + Draw.circle(e.x, e.y, e.ifract() * 5f + 1f); + Draw.reset(); + }), + + titanExplosion = new Effect(11, 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); + + Draw.color(e.ifract() < 0.5f ? whiteOrange : Color.DARK_GRAY); + float rad = e.fract()*10f + 5f; + Angles.randLenVectors(e.id, 5, 9f, (x, y)->{ + Draw.rect("circle2", e.x + x, e.y + y, rad, rad); + }); + + Draw.reset(); + }), + + explosion = new Effect(11, 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() * 6f); + + Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY); + float rad = e.fract()*10f + 5f; + Angles.randLenVectors(e.id, 5, 8f, (x, y)->{ + Draw.rect("circle2", e.x + x, e.y + y, rad, rad); + }); + + Draw.reset(); + }), + + + blockexplosion = new Effect(13, e -> { + Angles.randLenVectors(e.id+1, 8, 5f + e.ifract()*11f, (x, y)->{ + float size = 2f+e.fract()*8f; + Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); + Draw.rect("circle", e.x + x, e.y + y, size, size); + Draw.reset(); + }); + + Draw.thickness(2f*e.fract()+0.4f); + Draw.color(Color.WHITE, Color.ORANGE, e.powfract()); + Draw.circle(e.x, e.y, 2f + e.powfract() * 9f); + + Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY); + float rad = e.fract()*10f + 2f; + Angles.randLenVectors(e.id, 5, 8f, (x, y)->{ + Draw.rect("circle2", e.x + x, e.y + y, rad, rad); + }); + + Draw.reset(); + }), + + coreexplosion = new Effect(13, e -> { + Draw.thickness(3f-e.ifract()*2f); + Draw.color(Color.ORANGE, Color.WHITE, e.ifract()); + Draw.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6); + Draw.circle(e.x, e.y, 4f + e.ifract() * 40f); + Draw.reset(); + }), + + smoke = new Effect(100, e -> { + Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.ifract()); + float size = 7f-e.ifract()*7f; + Draw.rect("circle", e.x, e.y, size, size); + Draw.reset(); + }), + + railsmoke = new Effect(30, e -> { + Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract()); + float size = e.fract()*4f; + Draw.rect("circle", e.x, e.y, size, size); + Draw.reset(); + }), + + spawn = new Effect(23, e -> { + Draw.thickness(2f); + Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract()); + Draw.circle(e.x, e.y, 7f - e.ifract() * 6f); + Draw.reset(); + }), + + ind = new Effect(100, e -> { + Draw.thickness(3f); + Draw.color("royal"); + Draw.circle(e.x, e.y, 3); + Draw.reset(); + }), + + respawn = new Effect(Vars.respawnduration, e -> { + Draw.tcolor(Color.SCARLET); + Draw.tscl(0.25f); + Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y); + Draw.tscl(0.5f); + Draw.reset(); + }); +} diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 9571b03b0b..74336ade17 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -29,6 +29,10 @@ public class Vars{ public static boolean debug = false; //whether to debug openGL info public static boolean debugGL = false; + //whether turrets have infinite ammo (only with debug) + public static boolean infiniteAmmo = true; + //whether to show paths of enemies + public static boolean showPaths = false; //number of save slots-- increasing may lead to layout issues //TODO named save slots, possibly with a scroll dialog public static final int saveSlots = 4; diff --git a/core/src/io/anuke/mindustry/ai/Pathfind.java b/core/src/io/anuke/mindustry/ai/Pathfind.java index 564d9c53fe..918ddf426d 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfind.java +++ b/core/src/io/anuke/mindustry/ai/Pathfind.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.ai.pfa.indexed.IndexedAStarPathFinder; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.mindustry.world.Tile; @@ -85,9 +86,9 @@ public class Pathfind{ } - if(Vars.debug) + if(Vars.debug && Vars.showPaths) for(Tile tile : path){ - Effects.effect("ind", tile.worldx(), tile.worldy()); + Effects.effect(Fx.ind, tile.worldx(), tile.worldy()); } } diff --git a/core/src/io/anuke/mindustry/entities/BulletType.java b/core/src/io/anuke/mindustry/entities/BulletType.java index 326ddaafdc..b4477bc27d 100644 --- a/core/src/io/anuke/mindustry/entities/BulletType.java +++ b/core/src/io/anuke/mindustry/entities/BulletType.java @@ -2,7 +2,10 @@ package io.anuke.mindustry.entities; import com.badlogic.gdx.graphics.Color; +import io.anuke.mindustry.Fx; +import io.anuke.mindustry.entities.effect.DamageArea; import io.anuke.mindustry.entities.effect.EMP; +import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; @@ -14,6 +17,9 @@ import io.anuke.ucore.util.Mathf; public abstract class BulletType extends BaseBulletType{ static Color glowy = Color.valueOf("fdc056"); static Color lightGold = Hue.mix(Color.GOLD, Color.WHITE, 0.4f); + static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f); + static Color lightOrange = Color.valueOf("f68021"); + static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f); public static final BulletType @@ -36,8 +42,8 @@ public abstract class BulletType extends BaseBulletType{ }, chain = new BulletType(2f, 8){ public void draw(Bullet b){ - Draw.color("gray"); - Draw.rect("bullet", b.x, b.y, b.angle()); + Draw.color(whiteOrange); + Draw.rect("chainbullet", b.x, b.y, b.angle()); Draw.reset(); } }, @@ -51,7 +57,7 @@ public abstract class BulletType extends BaseBulletType{ public void update(Bullet b){ if(Timers.get(b, "smoke", 4)){ - Effects.effect("railsmoke", b.x, b.y); + Effects.effect(Fx.railsmoke, b.x, b.y); } } }, @@ -72,7 +78,7 @@ public abstract class BulletType extends BaseBulletType{ public void update(Bullet b){ if(Timers.get(b, "smoke", 2)){ - Effects.effect("empspark", b.x + Mathf.range(2), b.y + Mathf.range(2)); + Effects.effect(Fx.empspark, b.x + Mathf.range(2), b.y + Mathf.range(2)); } } @@ -84,19 +90,20 @@ public abstract class BulletType extends BaseBulletType{ Timers.run(5f, ()->{ new EMP(b.x, b.y, b.damage).add(); }); - Effects.effect("empshockwave", b); + Effects.effect(Fx.empshockwave, b); Effects.shake(3f, 3f, b); } }, - //TODO use DamageArea instead - shell = new BulletType(1.1f, 85){ + //TODO better visuals for shell + shell = new BulletType(1.1f, 60){ { lifetime = 110f; - hitsize = 8f; + hitsize = 11f; } public void draw(Bullet b){ float rad = 8f; + Draw.color(Color.ORANGE); Draw.color(Color.GRAY); Draw.rect("circle", b.x, b.y, rad, rad); rad += Mathf.sin(Timers.time(), 3f, 1f); @@ -107,7 +114,7 @@ public abstract class BulletType extends BaseBulletType{ public void update(Bullet b){ if(Timers.get(b, "smoke", 7)){ - Effects.effect("smoke", b.x + Mathf.range(2), b.y + Mathf.range(2)); + Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2)); } } @@ -118,13 +125,41 @@ public abstract class BulletType extends BaseBulletType{ public void removed(Bullet b){ Effects.shake(3f, 3f, b); - Effects.effect("shellsmoke", b); - Effects.effect("shellexplosion", b); + Effects.effect(Fx.shellsmoke, b); + Effects.effect(Fx.shellexplosion, b); - Angles.circle(25, f->{ - Angles.translation(f, 5f); - new Bullet(shellshot, b.owner, b.x + Angles.x(), b.y + Angles.y(), f).add(); - }); + DamageArea.damage(b.owner instanceof Enemy, b.x, b.y, 25f, (int)(damage * 2f/3f)); + } + }, + titanshell = new BulletType(1.8f, 60){ + { + lifetime = 70f; + hitsize = 11f; + } + + public void draw(Bullet b){ + Draw.color(whiteOrange); + Draw.rect("titanshell", b.x, b.y, b.angle()); + Draw.reset(); + } + + public void update(Bullet b){ + if(Timers.get(b, "smoke", 4)){ + Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2)); + } + } + + public void despawned(Bullet b){ + removed(b); + } + + public void removed(Bullet b){ + Effects.shake(3f, 3f, b); + + Effects.effect(Fx.shellsmoke, b); + Effects.effect(Fx.shockwaveSmall, b); + + DamageArea.damage(!(b.owner instanceof Enemy), b.x, b.y, 25f, (int)(damage * 2f/3f)); } }, blast = new BulletType(1.1f, 80){ @@ -141,8 +176,8 @@ public abstract class BulletType extends BaseBulletType{ public void removed(Bullet b){ Effects.shake(3f, 3f, b); - Effects.effect("blastsmoke", b); - Effects.effect("blastexplosion", b); + Effects.effect(Fx.blastsmoke, b); + Effects.effect(Fx.blastexplosion, b); Angles.circle(30, f->{ Angles.translation(f, 6f); @@ -239,6 +274,6 @@ public abstract class BulletType extends BaseBulletType{ @Override public void removed(Bullet b){ - Effects.effect("hit", b); + Effects.effect(Fx.hit, b); } } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 0b75e011af..5ee14ac993 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -7,6 +7,7 @@ import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.resource.Recipe; import io.anuke.mindustry.resource.Weapon; @@ -35,7 +36,7 @@ public class Player extends DestructibleEntity{ @Override public void onDeath(){ remove(); - Effects.effect("explosion", this); + Effects.effect(Fx.explosion, this); Effects.shake(4f, 5f, this); Effects.sound("die", this); diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index f1d82d653b..887bdf65b2 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -6,6 +6,7 @@ import java.io.IOException; import com.badlogic.gdx.utils.ObjectMap; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.mindustry.resource.Item; @@ -89,7 +90,7 @@ public class TileEntity extends Entity{ if(health != 0 && !(tile.block() instanceof Wall) && Mathf.chance(0.009f*Timers.delta()*(1f-(float)health/maxhealth))){ - Effects.effect("smoke", x+Mathf.range(4), y+Mathf.range(4)); + Effects.effect(Fx.smoke, x+Mathf.range(4), y+Mathf.range(4)); } tile.block().update(tile); diff --git a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java index ffd229c4bb..e90673946d 100644 --- a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java +++ b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java @@ -1,8 +1,47 @@ package io.anuke.mindustry.entities.effect; -import io.anuke.ucore.entities.Entity; +import com.badlogic.gdx.math.Vector2; + +import io.anuke.mindustry.Vars; +import io.anuke.mindustry.entities.enemies.Enemy; +import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.World; +import io.anuke.ucore.entities.Entities; +import io.anuke.ucore.util.Mathf; //TODO -public class DamageArea extends Entity{ - +public class DamageArea{ + + public static void damage(boolean enemies, float x, float y, float radius, int damage){ + + if(enemies){ + Entities.getNearby(x, y, radius*2, entity->{ + if(entity instanceof Enemy){ + Enemy enemy = (Enemy)entity; + if(enemy.distanceTo(x, y) > radius){ + return; + } + int amount = calculateDamage(x, y, enemy.x, enemy.y, radius, damage); + enemy.damage(amount); + } + }); + }else{ + int trad = (int)(radius / Vars.tilesize); + for(int dx = -trad; dx <= trad; dx ++){ + for(int dy= -trad; dy <= trad; dy ++){ + Tile tile = World.tile(Mathf.scl2(x, Vars.tilesize) + dx, Mathf.scl2(y, Vars.tilesize) + dy); + if(tile != null && tile.entity != null && Vector2.dst(dx, dy, 0, 0) <= trad){ + int amount = calculateDamage(x, y, tile.worldx(), tile.worldy(), radius, damage); + tile.entity.damage(amount); + } + } + } + } + } + + static int calculateDamage(float x, float y, float tx, float ty, float radius, int damage){ + float dist = Vector2.dst(x, y, tx, ty); + float scaled = 1f - dist/radius; + return (int)(damage * scaled); + } } diff --git a/core/src/io/anuke/mindustry/entities/effect/EMP.java b/core/src/io/anuke/mindustry/entities/effect/EMP.java index 339222a2b1..e2d6a280f9 100644 --- a/core/src/io/anuke/mindustry/entities/effect/EMP.java +++ b/core/src/io/anuke/mindustry/entities/effect/EMP.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.World; @@ -57,7 +58,7 @@ public class EMP extends TimedEntity{ p.setPower(tile, 0f); } - Effects.effect("empspark", tile.entity); + Effects.effect(Fx.empspark, tile.entity); tile.entity.damage(damage); } } diff --git a/core/src/io/anuke/mindustry/entities/effect/TeslaOrb.java b/core/src/io/anuke/mindustry/entities/effect/TeslaOrb.java index 8b9074b82e..1572a21c50 100644 --- a/core/src/io/anuke/mindustry/entities/effect/TeslaOrb.java +++ b/core/src/io/anuke/mindustry/entities/effect/TeslaOrb.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectSet; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.entities.enemies.Enemy; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; @@ -64,7 +65,7 @@ public class TeslaOrb extends Entity{ void damageEnemy(Enemy enemy){ //TODO enemy.damage(damage); - Effects.effect("laserhit", enemy.x + Mathf.range(2f), enemy.y + Mathf.range(2f)); + Effects.effect(Fx.laserhit, enemy.x + Mathf.range(2f), enemy.y + Mathf.range(2f)); } @Override diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index 6f7faafdb1..096bbe84d2 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.reflect.ClassReflection; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Shaders; import io.anuke.mindustry.Vars; import io.anuke.mindustry.ai.Pathfind; @@ -171,7 +172,7 @@ public class Enemy extends DestructibleEntity{ @Override public void onDeath(){ - Effects.effect("explosion", this); + Effects.effect(Fx.explosion, this); Effects.shake(3f, 4f, this); Effects.sound("explosion", this); remove(); diff --git a/core/src/io/anuke/mindustry/resource/Weapon.java b/core/src/io/anuke/mindustry/resource/Weapon.java index 80b472460d..5fe88c67eb 100644 --- a/core/src/io/anuke/mindustry/resource/Weapon.java +++ b/core/src/io/anuke/mindustry/resource/Weapon.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.Bullet; import io.anuke.mindustry.entities.BulletType; @@ -22,7 +23,7 @@ public enum Weapon{ @Override public void shoot(Player p){ super.shoot(p); - Effects.effect("shoot3", p.x + vector.x, p.y+vector.y); + Effects.effect(Fx.shoot3, p.x + vector.x, p.y+vector.y); } }, triblaster(13, BulletType.shot, "Shoots 3 bullets in a spread.", stack(Item.iron, 40)){ @@ -36,7 +37,7 @@ public enum Weapon{ bullet(p, p.x, p.y, ang+space); bullet(p, p.x, p.y, ang-space); - Effects.effect("shoot", p.x + vector.x, p.y+vector.y); + Effects.effect(Fx.shoot, p.x + vector.x, p.y+vector.y); } }, @@ -48,7 +49,7 @@ public enum Weapon{ bullet(p, p.x, p.y, ang + Mathf.range(8)); - Effects.effect("shoot2", p.x + vector.x, p.y+vector.y); + Effects.effect(Fx.shoot, p.x + vector.x, p.y+vector.y); } }, flamer(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){ @@ -73,7 +74,7 @@ public enum Weapon{ float ang = mouseAngle(p); bullet(p, p.x, p.y, ang); - Effects.effect("railshoot", p.x + vector.x, p.y+vector.y); + Effects.effect(Fx.railshoot, p.x + vector.x, p.y+vector.y); } }, mortar(100, BulletType.shell, "Shoots a slow, but damaging shell.", stack(Item.titanium, 40), stack(Item.steel, 60)){ @@ -82,7 +83,7 @@ public enum Weapon{ public void shoot(Player p){ float ang = mouseAngle(p); bullet(p, p.x, p.y, ang); - Effects.effect("mortarshoot", p.x + vector.x, p.y+vector.y); + Effects.effect(Fx.mortarshoot, p.x + vector.x, p.y+vector.y); Effects.shake(2f, 2f, Vars.player); } }; diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index ec5838c4ff..e22ae3baa1 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.GameState; import io.anuke.mindustry.GameState.State; import io.anuke.mindustry.Vars; @@ -13,6 +14,7 @@ import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.Liquid; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects; +import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.util.Tmp; public class Block{ private static int lastid; @@ -26,7 +28,7 @@ public class Block{ /**display name*/ public String formalName; /**played on destroy*/ - public String explosionEffect = "blockexplosion"; + public Effect explosionEffect = Fx.blockexplosion; /**played on destroy*/ public String explosionSound = "break"; /**whether this block has a tile entity that updates*/ diff --git a/core/src/io/anuke/mindustry/world/World.java b/core/src/io/anuke/mindustry/world/World.java index c78a1b2d1e..c0b2b5320a 100644 --- a/core/src/io/anuke/mindustry/world/World.java +++ b/core/src/io/anuke/mindustry/world/World.java @@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.math.*; import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.ai.Pathfind; import io.anuke.mindustry.entities.TileEntity; @@ -222,11 +223,11 @@ public class World{ toplace.setLinked((byte)(dx + offsetx), (byte)(dy + offsety)); } - Effects.effect("place", worldx * Vars.tilesize, worldy * Vars.tilesize); + Effects.effect(Fx.place, worldx * Vars.tilesize, worldy * Vars.tilesize); } } }else{ - Effects.effect("place", x * Vars.tilesize, y * Vars.tilesize); + Effects.effect(Fx.place, x * Vars.tilesize, y * Vars.tilesize); } Effects.shake(2f, 2f, player); @@ -307,14 +308,14 @@ public class World{ if(!tile.block().isMultiblock() && !tile.isLinked()){ tile.setBlock(Blocks.air); - Effects.effect("break", tile.worldx(), tile.worldy()); + Effects.effect(Fx.breakBlock, tile.worldx(), tile.worldy()); }else{ Tile target = tile.isLinked() ? tile.getLinked() : tile; Array removals = target.getLinkedTiles(); for(Tile toremove : removals){ //note that setting a new block automatically unlinks it toremove.setBlock(Blocks.air); - Effects.effect("break", toremove.worldx(), toremove.worldy()); + Effects.effect(Fx.breakBlock, toremove.worldx(), toremove.worldy()); } } } diff --git a/core/src/io/anuke/mindustry/world/blocks/Blocks.java b/core/src/io/anuke/mindustry/world/blocks/Blocks.java index db40495857..bfd48c6914 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Blocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/Blocks.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.world.blocks; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.GameState; import io.anuke.mindustry.GameState.State; import io.anuke.mindustry.resource.Item; @@ -51,11 +52,11 @@ public class Blocks{ @Override public void update(Tile tile){ if(Mathf.chance(0.001 * Timers.delta())){ - Effects.effect("lava", tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f)); + Effects.effect(Fx.lava, tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f)); } if(Mathf.chance(0.003 * Timers.delta())){ - Effects.effect("lavabubble", tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f)); + Effects.effect(Fx.lavabubble, tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f)); } } }, @@ -70,7 +71,7 @@ public class Blocks{ @Override public void update(Tile tile){ if(Mathf.chance(0.0025 * Timers.delta())){ - Effects.effect("oilbubble", tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f)); + Effects.effect(Fx.oilbubble, tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f)); } } }, diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index a9249b2662..88b6fd87b7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.world.blocks; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Liquid; @@ -113,7 +114,7 @@ public class ProductionBlocks{ purifyTime = 70; output = Item.coal; health = 80; - craftEffect = "purifyoil"; + craftEffect = Fx.purifyoil; } @Override @@ -164,7 +165,7 @@ public class ProductionBlocks{ if(tile.floor().drops != null && Timers.get(tile, "drill", 60 * time)){ offloadNear(tile, tile.floor().drops.item); - Effects.effect("sparkbig", tile.worldx(), tile.worldy()); + Effects.effect(Fx.sparkbig, tile.worldx(), tile.worldy()); } if(Timers.get(tile, "dump", 30)){ diff --git a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java index 16ef70742c..174ea2b2d7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/WeaponBlocks.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.BulletType; import io.anuke.mindustry.entities.effect.TeslaOrb; @@ -167,15 +168,49 @@ public class WeaponBlocks{ chainturret = new Turret("chainturret"){ { - inaccuracy = 7f; + inaccuracy = 8f; formalName = "chain turret"; - range = 60f; - reload = 10f; + range = 80f; + reload = 7f; bullet = BulletType.chain; - ammo = Item.stone; //TODO + ammo = Item.uranium; health = 430; - ammoMultiplier = 10; width = height = 2; + shootCone = 9f; + } + + //TODO specify turret shoot effect in turret instead of doing it manually + @Override + protected void shoot(Tile tile){ + TurretEntity entity = tile.entity(); + Vector2 offset = getPlaceOffset(); + + float len = 8; + float space = 3.5f; + + for(int i = -1; i < 1; i ++){ + Angles.vector.set(len, Mathf.sign(i) * space).rotate(entity.rotation); + bullet(tile, entity.rotation); + Effects.effect(Fx.chainshot, tile.worldx() + Angles.x() + offset.x, + tile.worldy()+ Angles.y() + offset.y, entity.rotation); + } + + Effects.shake(1f, 1f, tile.worldx(), tile.worldy()); + } + }, + + titanturret = new Turret("titancannon"){ + { + formalName = "titan cannon"; + range = 120f; + reload = 20f; + bullet = BulletType.titanshell; + ammo = Item.uranium; + health = 800; + ammoMultiplier = 5; + width = height = 3; + rotatespeed = 0.07f; + shootCone = 9f; } @Override @@ -183,31 +218,12 @@ public class WeaponBlocks{ TurretEntity entity = tile.entity(); Vector2 offset = getPlaceOffset(); - float len = 8; - float space = 4f; + Angles.translation(entity.rotation, 14f); + bullet(tile, entity.rotation); + Effects.effect(Fx.titanshot, tile.worldx() + Angles.x() + offset.x, + tile.worldy()+ Angles.y() + offset.y, entity.rotation); - Angles.vector.set(len, -space).rotate(entity.rotation); - bullet(tile, entity.rotation); - Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation); - - Angles.vector.set(len, space).rotate(entity.rotation); - bullet(tile, entity.rotation); - Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation); - } - }, - - titanturret = new Turret("titancannon"){ - { - inaccuracy = 7f; - formalName = "titan cannon"; - range = 120f; - reload = 40f; - bullet = BulletType.shell; - ammo = Item.coal; - health = 800; - ammoMultiplier = 10; - width = height = 3; - rotatespeed = 0.08f; + Effects.shake(3f, 3f, tile.worldx(), tile.worldy()); } }; } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java b/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java index 57727c298a..18f5585ce6 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/defense/LaserTurret.java @@ -3,10 +3,12 @@ package io.anuke.mindustry.world.blocks.types.defense; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.MathUtils; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.entities.enemies.Enemy; 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.Angles; import io.anuke.ucore.util.Mathf; @@ -14,7 +16,7 @@ import io.anuke.ucore.util.Tmp; public class LaserTurret extends PowerTurret{ protected Color beamColor = Color.WHITE.cpy(); - protected String hiteffect = "laserhit"; + protected Effect hiteffect = Fx.laserhit; protected int damage = 4; protected float cone = 15f; 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 ae609d80df..8c498abdff 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 @@ -7,6 +7,7 @@ import java.io.IOException; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.Bullet; import io.anuke.mindustry.entities.BulletType; @@ -188,7 +189,7 @@ public class Turret extends Block{ if(Timers.getTime(tile, "reload") <= 0){ Timers.run(hittime, ()->{ - Effects.effect("spawn", predictX, predictY); + Effects.effect(Fx.spawn, predictX, predictY); }); } } @@ -206,7 +207,8 @@ public class Turret extends Block{ } protected void bullet(Tile tile, float angle){ - Bullet out = new Bullet(bullet, tile.entity, tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), angle).add(); + Vector2 offset = getPlaceOffset(); + Bullet out = new Bullet(bullet, tile.entity, tile.worldx() + Angles.x() + offset.x, tile.worldy() + Angles.y() + offset.y, angle).add(); out.damage = (int)(bullet.damage*Vars.multiplier); } 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 3a451eec56..9648b5d805 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 @@ -1,5 +1,6 @@ package io.anuke.mindustry.world.blocks.types.production; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -34,7 +35,7 @@ public class Crafter extends Block{ } offloadNear(tile, result); - Effects.effect("smelt", tile.entity); + Effects.effect(Fx.smelt, tile.entity); } @Override 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 ece8d267a4..6e16f4196b 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 @@ -1,5 +1,6 @@ package io.anuke.mindustry.world.blocks.types.production; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -25,7 +26,7 @@ public class Drill extends Block{ if(tile.floor() == resource && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < capacity){ offloadNear(tile, result); - Effects.effect("spark", tile.worldx(), tile.worldy()); + Effects.effect(Fx.spark, tile.worldx(), tile.worldy()); } if(Timers.get(tile, "dump", 30)){ 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 65c09d2649..9a332f83a0 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 @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.World; @@ -35,13 +36,13 @@ public class Generator extends PowerBlock{ if(explosive){ float x = tile.worldx(), y = tile.worldy(); - Effects.effect("shellsmoke", x, y); - Effects.effect("blastsmoke", x, y); + Effects.effect(Fx.shellsmoke, x, y); + Effects.effect(Fx.blastsmoke, x, y); Timers.run(Mathf.random(8f + Mathf.random(6f)), () -> { Effects.shake(6f, 8f, x, y); - Effects.effect("generatorexplosion", x, y); - Effects.effect("shockwave", x, y); + Effects.effect(Fx.generatorexplosion, x, y); + Effects.effect(Fx.shockwave, x, y); Timers.run(12f + Mathf.random(20f), () -> { tile.damageNearby(3, 40, 0f); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java index a0be1e9a6f..15795421b8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/ItemPowerGenerator.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.graphics.Color; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Item; @@ -37,7 +38,7 @@ public class ItemPowerGenerator extends Generator{ PowerEntity entity = tile.entity(); if(entity.hasItem(generateItem) && tryAddPower(tile, generateAmount)){ - Effects.effect("generate", tile.entity); + Effects.effect(Fx.generate, tile.entity); entity.removeItem(generateItem, 1); } 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 6fcd3552a5..2b74722d8f 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 @@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.graphics.Color; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.Vars; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Item; @@ -10,6 +11,7 @@ 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.Effects; +import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Timers; public class LiquidCrafter extends LiquidBlock{ @@ -21,7 +23,7 @@ public class LiquidCrafter extends LiquidBlock{ public Item output = null; public int itemCapacity = 90; public int purifyTime = 80; - public String craftEffect = "purify"; + public Effect craftEffect = Fx.purify; public LiquidCrafter(String name) { super(name); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java index 4edc0d5274..f12f119e22 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidPowerGenerator.java @@ -6,12 +6,14 @@ import java.io.IOException; import com.badlogic.gdx.math.Vector2; +import io.anuke.mindustry.Fx; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.resource.Liquid; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.LiquidAcceptor; 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; public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ @@ -22,7 +24,7 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{ /**How much liquid to consume to get one generatePower.*/ public float inputLiquid = 5f; public float liquidCapacity = 30f; - public String generateEffect = "generate"; + public Effect generateEffect = Fx.generate; public LiquidPowerGenerator(String name) { super(name); diff --git a/core/src/io/anuke/ucore/function/EffectProvider.java b/core/src/io/anuke/ucore/function/EffectProvider.java index 141601399b..4f40ffe705 100644 --- a/core/src/io/anuke/ucore/function/EffectProvider.java +++ b/core/src/io/anuke/ucore/function/EffectProvider.java @@ -2,6 +2,8 @@ package io.anuke.ucore.function; import com.badlogic.gdx.graphics.Color; +import io.anuke.ucore.core.Effects.Effect; + public interface EffectProvider{ - public void createEffect(String name, Color color, float x, float y, float rotation); + public void createEffect(Effect effect, Color color, float x, float y, float rotation); } diff --git a/desktop/mindustry-saves/0.mins b/desktop/mindustry-saves/0.mins index 45bc7ffc0e..e7e476f70c 100644 Binary files a/desktop/mindustry-saves/0.mins and b/desktop/mindustry-saves/0.mins differ diff --git a/desktop/mindustry-saves/1.mins b/desktop/mindustry-saves/1.mins index 501a5cb318..ac5303ac6a 100644 Binary files a/desktop/mindustry-saves/1.mins and b/desktop/mindustry-saves/1.mins differ