From 4ec8e24bd860f3fcf45d22d637e2cad3383d0afa Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 30 Oct 2020 19:03:05 -0400 Subject: [PATCH] Cleanup of merged PR --- core/src/mindustry/content/Bullets.java | 29 ++++++++++--------- core/src/mindustry/content/TechTree.java | 6 ++-- core/src/mindustry/content/UnitTypes.java | 6 ++-- core/src/mindustry/entities/Damage.java | 10 ++++--- core/src/mindustry/entities/Lightning.java | 10 ++----- .../mindustry/entities/bullet/BulletType.java | 8 +++-- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index 569fed46fc..11247dac2f 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -42,6 +42,21 @@ public class Bullets implements ContentList{ @Override public void load(){ + //lightning bullets need to be initialized first. + damageLightning = new BulletType(0.0001f, 0f){{ + lifetime = Fx.lightning.lifetime; + hitEffect = Fx.hitLancer; + despawnEffect = Fx.none; + status = StatusEffects.shocked; + statusDuration = 10f; + hittable = false; + }}; + + //this is just a copy of the damage lightning bullet that doesn't damage air units + damageLightningGround = new BulletType(0.0001f, 0f){}; + JsonIO.copy(damageLightning, damageLightningGround); + damageLightningGround.collidesAir = false; + artilleryDense = new ArtilleryBulletType(3f, 20, "shell"){{ hitEffect = Fx.flakExplosion; knockback = 0.8f; @@ -357,20 +372,6 @@ public class Bullets implements ContentList{ pierceBuilding = true; }}; - damageLightning = new BulletType(0.0001f, 0f){{ - lifetime = Fx.lightning.lifetime; - hitEffect = Fx.hitLancer; - despawnEffect = Fx.none; - status = StatusEffects.shocked; - statusDuration = 10f; - hittable = false; - }}; - - //this is just a copy of the damage lightning bullet that doesn't damage air units - damageLightningGround = new BulletType(0.0001f, 0f){}; - JsonIO.copy(damageLightning, damageLightningGround); - damageLightningGround.collidesAir = false; - healBullet = new LaserBoltBulletType(5.2f, 13){{ healPercent = 3f; collidesTeam = true; diff --git a/core/src/mindustry/content/TechTree.java b/core/src/mindustry/content/TechTree.java index e9b12cbf39..13d7c8c7ac 100644 --- a/core/src/mindustry/content/TechTree.java +++ b/core/src/mindustry/content/TechTree.java @@ -120,7 +120,7 @@ public class TechTree implements ContentList{ }); }); - node(Items.thorium, with(Items.titanium, 8000, Items.lead, 15000, Items.copper, 20000), () -> { + node(Items.thorium, with(Items.titanium, 8000, Items.lead, 12000, Items.copper, 20000), () -> { node(laserDrill, () -> { node(blastDrill, () -> { @@ -136,7 +136,7 @@ public class TechTree implements ContentList{ }); }); - node(Items.pyratite, with(Items.coal, 6000, Items.lead, 10000, Items.sand, 4000), () -> { + node(Items.pyratite, with(Items.coal, 6000, Items.lead, 8000, Items.sand, 4000), () -> { node(pyratiteMixer, () -> { node(Items.blastCompound, with(Items.pyratite, 3000, Items.sporePod, 3000), () -> { node(blastMixer, () -> { @@ -159,7 +159,7 @@ public class TechTree implements ContentList{ }); }); - node(Items.plastanium, with(Items.titanium, 10000, Items.silicon, 10000), () -> { + node(Items.plastanium, with(Items.titanium, 8000, Items.silicon, 8000), () -> { node(plastaniumCompressor, () -> { node(Items.phaseFabric, with(Items.thorium, 12000, Items.sand, 8000, Items.silicon, 5000), () -> { node(phaseWeaver, () -> { diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index be1b56d7c5..62ea1d0cba 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -332,14 +332,14 @@ public class UnitTypes implements ContentList{ lightningLengthRand = 7; shootEffect = Fx.shootHeal; - lightningHitter = new BulletType(0.0001f, 0f){{ + lightningType = new BulletType(0.0001f, 0f){{ lifetime = Fx.lightning.lifetime; hitEffect = Fx.hitLancer; despawnEffect = Fx.none; status = StatusEffects.shocked; statusDuration = 10f; hittable = false; - healPercent = 5f; + healPercent = 2f; collidesTeam = true; }}; }}; @@ -518,7 +518,7 @@ public class UnitTypes implements ContentList{ shootEffect = Fx.greenLaserCharge; - healPercent = 20f; + healPercent = 25f; collidesTeam = true; sideAngle = 15f; diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index 129eea7b31..cd3777d063 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -115,13 +115,15 @@ public class Damage{ tr.trns(angle, length); Intc2 collider = (cx, cy) -> { Building tile = world.build(cx, cy); - if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.team != team && tile.collide(hitter)){ + boolean collide = tile != null && collidedBlocks.add(tile.pos()); + + if(collide && tile.team != team && tile.collide(hitter)){ tile.collision(hitter); - collidedBlocks.add(tile.pos()); hitter.type.hit(hitter, tile.x, tile.y); } - //can heal? - if(tile != null && !collidedBlocks.contains(tile.pos()) && hitter.type.collides(hitter, tile)){ + + //try to heal the tile + if(collide && hitter.type.collides(hitter, tile)){ hitter.type.hitTile(hitter, tile, 0f); } }; diff --git a/core/src/mindustry/entities/Lightning.java b/core/src/mindustry/entities/Lightning.java index d54400f224..21e9d91a9f 100644 --- a/core/src/mindustry/entities/Lightning.java +++ b/core/src/mindustry/entities/Lightning.java @@ -37,18 +37,12 @@ public class Lightning{ random.setSeed(seed); hit.clear(); - BulletType bulletType; - if(hitter != null && hitter.type.lightningHitter != null){ - bulletType = hitter.type.lightningHitter; - }else{ - bulletType = hitter != null && !hitter.type.collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning; - } - + BulletType hitCreate = hitter.type.lightningType; Seq lines = new Seq<>(); bhit = false; for(int i = 0; i < length / 2; i++){ - bulletType.create(null, team, x, y, 0f, damage, 1f, 1f, hitter); + hitCreate.create(null, team, x, y, 0f, damage, 1f, 1f, hitter); lines.add(new Vec2(x + Mathf.range(3f), y + Mathf.range(3f))); if(lines.size > 1){ diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 2c12cee5fe..189f984293 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -116,8 +116,8 @@ public abstract class BulletType extends Content{ public float lightningDamage = -1; public float lightningCone = 360f; public float lightningAngle = 0f; - /** The lighting "hitter"; Use when trying to implement special lightning. */ - public BulletType lightningHitter; + /** The bullet created at lightning points. */ + public BulletType lightningType; public float weaveScale = 1f; public float weaveMag = -1f; @@ -257,6 +257,10 @@ public abstract class BulletType extends Content{ //pierceBuilding is not enabled by default, because a bullet may want to *not* pierce buildings } + if(lightningType == null){ + lightningType = !collidesAir ? Bullets.damageLightningGround : Bullets.damageLightning; + } + if(killShooter && b.owner() instanceof Healthc){ ((Healthc)b.owner()).kill(); }