From 5416ad33bd7479a65ea873721362cf2fb74f5a6b Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 28 Aug 2018 13:10:49 -0400 Subject: [PATCH] Basic fuse implementation --- .../io/anuke/mindustry/content/AmmoTypes.java | 5 +++- .../content/blocks/TurretBlocks.java | 3 ++ .../content/bullets/TurretBullets.java | 30 ++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/core/src/io/anuke/mindustry/content/AmmoTypes.java b/core/src/io/anuke/mindustry/content/AmmoTypes.java index a0da332ba8..9b91c92eca 100644 --- a/core/src/io/anuke/mindustry/content/AmmoTypes.java +++ b/core/src/io/anuke/mindustry/content/AmmoTypes.java @@ -200,7 +200,10 @@ public class AmmoTypes implements ContentList{ meltdownLaser = new AmmoType(TurretBullets.lancerLaser); - fuseShotgun = new AmmoType(Items.copper, TurretBullets.fuseShot, 0.1f); + fuseShotgun = new AmmoType(Items.densealloy, TurretBullets.fuseShot, 1f){{ + shootEffect = ShootFx.shootBig2; + smokeEffect = ShootFx.shootBigSmoke2; + }}; //liquid diff --git a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java index ba451b38c9..ed4ac35a1c 100644 --- a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java @@ -216,6 +216,9 @@ public class TurretBlocks extends BlockList implements ContentList{ fuse = new ItemTurret("fuse"){{ //TODO make it use power ammoTypes = new AmmoType[]{AmmoTypes.fuseShotgun}; + reload = 50f; + shootShake = 4f; + range = 70f; size = 3; }}; diff --git a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java index 20aa35c138..9b898a9a5c 100644 --- a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java @@ -24,6 +24,7 @@ import io.anuke.ucore.core.Timers; import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Fill; import io.anuke.ucore.graphics.Lines; +import io.anuke.ucore.graphics.Shapes; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; @@ -159,7 +160,34 @@ public class TurretBullets extends BulletList implements ContentList{ } }; - fuseShot = new BulletType(0.01f, 100){ + fuseShot = new BulletType(0.01f, 0){ + int rays = 3; + float raySpace = 2f; + float rayLength = 70f; + { + hiteffect = BulletFx.hitBulletBig; + lifetime = 10f; + despawneffect = Fx.none; + pierce = true; + } + + @Override + public void init(Bullet b) { + for (int i = 0; i < rays; i++) { + float offset = (i-rays/2)*raySpace; + vector.trns(b.angle(), 0.01f, offset); + Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), rayLength - Math.abs(i - (rays/2))*20f); + } + } + + @Override + public void draw(Bullet b) { + super.draw(b); + Draw.color(Color.WHITE, Palette.surge, b.fin()); + Shapes.tri(b.x, b.y, 12f, (rayLength+10) * b.fout(), b.angle()); + Draw.reset(); + } + //TODO };