From bc0b0b254d547c431baccb8cbc27b2f22ca8006e Mon Sep 17 00:00:00 2001 From: Anuke Date: Sun, 6 Mar 2022 10:03:40 -0500 Subject: [PATCH] Bullet cleap & inlining --- core/src/mindustry/content/Blocks.java | 479 ++++++++++++++++-- core/src/mindustry/content/Bullets.java | 456 +---------------- .../src/mindustry/content/ErekirTechTree.java | 4 +- core/src/mindustry/content/UnitTypes.java | 35 +- .../entities/bullet/ArtilleryBulletType.java | 1 + core/src/mindustry/type/UnitType.java | 8 + core/src/mindustry/type/Weapon.java | 4 +- .../type/weapons/RepairBeamWeapon.java | 1 + .../defense/turrets/ContinuousTurret.java | 2 +- 9 files changed, 492 insertions(+), 498 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 7074cb4976..ff2677545e 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -2750,10 +2750,27 @@ public class Blocks{ duo = new ItemTurret("duo"){{ requirements(Category.turret, with(Items.copper, 35), true); ammo( - Items.copper, Bullets.standardCopper, - Items.graphite, Bullets.standardDense, - Items.pyratite, Bullets.standardIncendiary, - Items.silicon, Bullets.standardHoming + Items.copper, new BasicBulletType(2.5f, 9){{ + width = 7f; + height = 9f; + lifetime = 60f; + ammoMultiplier = 2; + }}, + Items.graphite, new BasicBulletType(3.5f, 18){{ + width = 9f; + height = 12f; + reloadMultiplier = 0.6f; + ammoMultiplier = 4; + lifetime = 60f; + }}, + Items.silicon, new BasicBulletType(3f, 12){{ + width = 7f; + height = 9f; + homingPower = 0.1f; + reloadMultiplier = 1.5f; + ammoMultiplier = 5; + lifetime = 60f; + }} ); shoot = new ShootAlternate(){{ @@ -2777,9 +2794,49 @@ public class Blocks{ scatter = new ItemTurret("scatter"){{ requirements(Category.turret, with(Items.copper, 85, Items.lead, 45)); ammo( - Items.scrap, Bullets.flakScrap, - Items.lead, Bullets.flakLead, - Items.metaglass, Bullets.flakGlass + Items.scrap, new FlakBulletType(4f, 3){{ + lifetime = 60f; + ammoMultiplier = 5f; + shootEffect = Fx.shootSmall; + reloadMultiplier = 0.5f; + width = 6f; + height = 8f; + hitEffect = Fx.flakExplosion; + splashDamage = 22f * 1.5f; + splashDamageRadius = 24f; + }}, + Items.lead, new FlakBulletType(4.2f, 3){{ + lifetime = 60f; + ammoMultiplier = 4f; + shootEffect = Fx.shootSmall; + width = 6f; + height = 8f; + hitEffect = Fx.flakExplosion; + splashDamage = 27f * 1.5f; + splashDamageRadius = 15f; + }}, + Items.metaglass, new FlakBulletType(4f, 3){{ + lifetime = 60f; + ammoMultiplier = 5f; + shootEffect = Fx.shootSmall; + reloadMultiplier = 0.8f; + width = 6f; + height = 8f; + hitEffect = Fx.flakExplosion; + splashDamage = 25f * 1.5f; + splashDamageRadius = 20f; + fragBullets = 6; + fragBullet = new BasicBulletType(3f, 5){{ + width = 5f; + height = 12f; + shrinkY = 1f; + lifetime = 20f; + backColor = Pal.gray; + frontColor = Color.white; + despawnEffect = Fx.none; + collidesGround = false; + }}; + }} ); reload = 18f; range = 220f; @@ -2804,8 +2861,33 @@ public class Blocks{ scorch = new ItemTurret("scorch"){{ requirements(Category.turret, with(Items.copper, 25, Items.graphite, 22)); ammo( - Items.coal, Bullets.basicFlame, - Items.pyratite, Bullets.pyraFlame + Items.coal, new BulletType(3.35f, 17f){{ + ammoMultiplier = 3f; + hitSize = 7f; + lifetime = 18f; + pierce = true; + collidesAir = false; + statusDuration = 60f * 4; + shootEffect = Fx.shootSmallFlame; + hitEffect = Fx.hitFlameSmall; + despawnEffect = Fx.none; + status = StatusEffects.burning; + keepVelocity = false; + hittable = false; + }}, + Items.pyratite, new BulletType(4f, 60f){{ + ammoMultiplier = 6f; + hitSize = 7f; + lifetime = 18f; + pierce = true; + collidesAir = false; + statusDuration = 60f * 10; + shootEffect = Fx.shootPyraFlame; + hitEffect = Fx.hitFlameSmall; + despawnEffect = Fx.none; + status = StatusEffects.burning; + hittable = false; + }} ); recoilAmount = 0f; reload = 6f; @@ -2822,9 +2904,42 @@ public class Blocks{ hail = new ItemTurret("hail"){{ requirements(Category.turret, with(Items.copper, 40, Items.graphite, 17)); ammo( - Items.graphite, Bullets.artilleryDense, - Items.silicon, Bullets.artilleryHoming, - Items.pyratite, Bullets.artilleryIncendiary + Items.graphite, new ArtilleryBulletType(3f, 20){{ + knockback = 0.8f; + lifetime = 80f; + width = height = 11f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 33f; + }}, + Items.silicon, new ArtilleryBulletType(3f, 20){{ + knockback = 0.8f; + lifetime = 80f; + width = height = 11f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 33f; + reloadMultiplier = 1.2f; + ammoMultiplier = 3f; + homingPower = 0.08f; + homingRange = 50f; + }}, + Items.pyratite, new ArtilleryBulletType(3f, 25){{ + hitEffect = Fx.blastExplosion; + knockback = 0.8f; + lifetime = 80f; + width = height = 13f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 45f; + status = StatusEffects.burning; + statusDuration = 60f * 12f; + frontColor = Pal.lightishOrange; + backColor = Pal.lightOrange; + makeFire = true; + trailEffect = Fx.incendTrail; + ammoMultiplier = 4f; + }} ); targetAir = false; reload = 60f; @@ -2841,10 +2956,20 @@ public class Blocks{ wave = new LiquidTurret("wave"){{ requirements(Category.turret, with(Items.metaglass, 45, Items.lead, 75, Items.copper, 25)); ammo( - Liquids.water, Bullets.waterShot, - Liquids.slag, Bullets.slagShot, - Liquids.cryofluid, Bullets.cryoShot, - Liquids.oil, Bullets.oilShot + Liquids.water,new LiquidBulletType(Liquids.water){{ + knockback = 0.7f; + drag = 0.01f; + }}, + Liquids.slag, new LiquidBulletType(Liquids.slag){{ + damage = 4; + drag = 0.01f; + }}, + Liquids.cryofluid, new LiquidBulletType(Liquids.cryofluid){{ + drag = 0.01f; + }}, + Liquids.oil, new LiquidBulletType(Liquids.oil){{ + drag = 0.01f; + }} ); size = 2; recoilAmount = 0f; @@ -2937,9 +3062,46 @@ public class Blocks{ swarmer = new ItemTurret("swarmer"){{ requirements(Category.turret, with(Items.graphite, 35, Items.titanium, 35, Items.plastanium, 45, Items.silicon, 30)); ammo( - Items.blastCompound, Bullets.missileExplosive, - Items.pyratite, Bullets.missileIncendiary, - Items.surgeAlloy, Bullets.missileSurge + Items.blastCompound, new MissileBulletType(3.7f, 10){{ + width = 8f; + height = 8f; + shrinkY = 0f; + splashDamageRadius = 30f; + splashDamage = 30f * 1.5f; + ammoMultiplier = 5f; + hitEffect = Fx.blastExplosion; + despawnEffect = Fx.blastExplosion; + + status = StatusEffects.blasted; + statusDuration = 60f; + }}, + Items.pyratite, new MissileBulletType(3.7f, 12){{ + frontColor = Pal.lightishOrange; + backColor = Pal.lightOrange; + width = 7f; + height = 8f; + shrinkY = 0f; + homingPower = 0.08f; + splashDamageRadius = 20f; + splashDamage = 30f * 1.5f; + makeFire = true; + ammoMultiplier = 5f; + hitEffect = Fx.blastExplosion; + status = StatusEffects.burning; + }}, + Items.surgeAlloy, new MissileBulletType(3.7f, 18){{ + width = 8f; + height = 8f; + shrinkY = 0f; + splashDamageRadius = 25f; + splashDamage = 25f * 1.4f; + hitEffect = Fx.blastExplosion; + despawnEffect = Fx.blastExplosion; + ammoMultiplier = 4f; + lightningDamage = 10; + lightning = 2; + lightningLength = 10; + }} ); shoot = new ShootAlternate(){{ @@ -2965,11 +3127,51 @@ public class Blocks{ salvo = new ItemTurret("salvo"){{ requirements(Category.turret, with(Items.copper, 100, Items.graphite, 80, Items.titanium, 50)); ammo( - Items.copper, Bullets.standardCopper, - Items.graphite, Bullets.standardDense, - Items.pyratite, Bullets.standardIncendiary, - Items.silicon, Bullets.standardHoming, - Items.thorium, Bullets.standardThorium + Items.copper, new BasicBulletType(2.5f, 11){{ + width = 7f; + height = 9f; + lifetime = 60f; + ammoMultiplier = 2; + }}, + Items.graphite, new BasicBulletType(3.5f, 20){{ + width = 9f; + height = 12f; + reloadMultiplier = 0.6f; + ammoMultiplier = 4; + lifetime = 60f; + }}, + Items.pyratite, new BasicBulletType(3.2f, 18){{ + width = 10f; + height = 12f; + frontColor = Pal.lightishOrange; + backColor = Pal.lightOrange; + status = StatusEffects.burning; + hitEffect = new MultiEffect(Fx.hitBulletSmall, Fx.fireHit); + + ammoMultiplier = 5; + + splashDamage = 12f; + splashDamageRadius = 22f; + + makeFire = true; + lifetime = 60f; + }}, + Items.silicon, new BasicBulletType(3f, 15, "bullet"){{ + width = 7f; + height = 9f; + homingPower = 0.1f; + reloadMultiplier = 1.5f; + ammoMultiplier = 5; + lifetime = 60f; + }}, + Items.thorium, new BasicBulletType(4f, 29, "bullet"){{ + width = 10f; + height = 13f; + shootEffect = Fx.shootBig; + smokeEffect = Fx.shootBigSmoke; + ammoMultiplier = 4; + lifetime = 60f; + }} ); size = 2; @@ -3008,10 +3210,50 @@ public class Blocks{ tsunami = new LiquidTurret("tsunami"){{ requirements(Category.turret, with(Items.metaglass, 100, Items.lead, 400, Items.titanium, 250, Items.thorium, 100)); ammo( - Liquids.water, Bullets.heavyWaterShot, - Liquids.slag, Bullets.heavySlagShot, - Liquids.cryofluid, Bullets.heavyCryoShot, - Liquids.oil, Bullets.heavyOilShot + Liquids.water, new LiquidBulletType(Liquids.water){{ + lifetime = 49f; + speed = 4f; + knockback = 1.7f; + puddleSize = 8f; + orbSize = 4f; + drag = 0.001f; + ammoMultiplier = 0.4f; + statusDuration = 60f * 4f; + damage = 0.2f; + }}, + Liquids.slag, new LiquidBulletType(Liquids.slag){{ + lifetime = 49f; + speed = 4f; + knockback = 1.3f; + puddleSize = 8f; + orbSize = 4f; + damage = 4.75f; + drag = 0.001f; + ammoMultiplier = 0.4f; + statusDuration = 60f * 4f; + }}, + Liquids.cryofluid, new LiquidBulletType(Liquids.cryofluid){{ + lifetime = 49f; + speed = 4f; + knockback = 1.3f; + puddleSize = 8f; + orbSize = 4f; + drag = 0.001f; + ammoMultiplier = 0.4f; + statusDuration = 60f * 4f; + damage = 0.2f; + }}, + Liquids.oil, new LiquidBulletType(Liquids.oil){{ + lifetime = 49f; + speed = 4f; + knockback = 1.3f; + puddleSize = 8f; + orbSize = 4f; + drag = 0.001f; + ammoMultiplier = 0.4f; + statusDuration = 60f * 4f; + damage = 0.2f; + }} ); size = 3; reload = 3f; @@ -3073,11 +3315,78 @@ public class Blocks{ ripple = new ItemTurret("ripple"){{ requirements(Category.turret, with(Items.copper, 150, Items.graphite, 135, Items.titanium, 60)); ammo( - Items.graphite, Bullets.artilleryDense, - Items.silicon, Bullets.artilleryHoming, - Items.pyratite, Bullets.artilleryIncendiary, - Items.blastCompound, Bullets.artilleryExplosive, - Items.plastanium, Bullets.artilleryPlastic + Items.graphite, new ArtilleryBulletType(3f, 20){{ + knockback = 0.8f; + lifetime = 80f; + width = height = 11f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 33f; + }}, + Items.silicon, new ArtilleryBulletType(3f, 20){{ + knockback = 0.8f; + lifetime = 80f; + width = height = 11f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 33f; + reloadMultiplier = 1.2f; + ammoMultiplier = 3f; + homingPower = 0.08f; + homingRange = 50f; + }}, + Items.pyratite, new ArtilleryBulletType(3f, 24){{ + hitEffect = Fx.blastExplosion; + knockback = 0.8f; + lifetime = 80f; + width = height = 13f; + collidesTiles = false; + splashDamageRadius = 25f * 0.75f; + splashDamage = 45f; + status = StatusEffects.burning; + statusDuration = 60f * 12f; + frontColor = Pal.lightishOrange; + backColor = Pal.lightOrange; + makeFire = true; + trailEffect = Fx.incendTrail; + ammoMultiplier = 4f; + }}, + Items.blastCompound, new ArtilleryBulletType(2f, 20, "shell"){{ + hitEffect = Fx.blastExplosion; + knockback = 0.8f; + lifetime = 80f; + width = height = 14f; + collidesTiles = false; + ammoMultiplier = 4f; + splashDamageRadius = 45f * 0.75f; + splashDamage = 55f; + backColor = Pal.missileYellowBack; + frontColor = Pal.missileYellow; + + status = StatusEffects.blasted; + }}, + Items.plastanium, new ArtilleryBulletType(3.4f, 20, "shell"){{ + hitEffect = Fx.plasticExplosion; + knockback = 1f; + lifetime = 80f; + width = height = 13f; + collidesTiles = false; + splashDamageRadius = 35f * 0.75f; + splashDamage = 45f; + fragBullet = new BasicBulletType(2.5f, 10, "bullet"){{ + width = 10f; + height = 12f; + shrinkY = 1f; + lifetime = 15f; + backColor = Pal.plastaniumBack; + frontColor = Pal.plastaniumFront; + despawnEffect = Fx.none; + collidesAir = false; + }}; + fragBullets = 10; + backColor = Pal.plastaniumBack; + frontColor = Pal.plastaniumFront; + }} ); targetAir = false; @@ -3104,10 +3413,68 @@ public class Blocks{ cyclone = new ItemTurret("cyclone"){{ requirements(Category.turret, with(Items.copper, 200, Items.titanium, 125, Items.plastanium, 80)); ammo( - Items.metaglass, Bullets.fragGlass, - Items.blastCompound, Bullets.fragExplosive, - Items.plastanium, Bullets.fragPlastic, - Items.surgeAlloy, Bullets.fragSurge + Items.metaglass, new FlakBulletType(4f, 9){{ + ammoMultiplier = 3f; + shootEffect = Fx.shootSmall; + reloadMultiplier = 0.8f; + width = 6f; + height = 8f; + hitEffect = Fx.flakExplosion; + splashDamage = 28f * 1.5f; + splashDamageRadius = 22f; + fragBullet = new BasicBulletType(3f, 5, "bullet"){{ + width = 5f; + height = 12f; + shrinkY = 1f; + lifetime = 20f; + backColor = Pal.gray; + frontColor = Color.white; + despawnEffect = Fx.none; + }}; + fragBullets = 4; + explodeRange = 20f; + collidesGround = true; + }}, + Items.blastCompound, new FlakBulletType(4f, 5){{ + shootEffect = Fx.shootBig; + ammoMultiplier = 5f; + splashDamage = 26f * 1.5f; + splashDamageRadius = 60f; + collidesGround = true; + + status = StatusEffects.blasted; + statusDuration = 60f; + }}, + Items.plastanium, new FlakBulletType(4f, 6){{ + splashDamageRadius = 40f; + splashDamage = 25f * 1.5f; + fragBullet = new BasicBulletType(2.5f, 12, "bullet"){{ + width = 10f; + height = 12f; + shrinkY = 1f; + lifetime = 15f; + backColor = Pal.plastaniumBack; + frontColor = Pal.plastaniumFront; + despawnEffect = Fx.none; + }}; + fragBullets = 6; + hitEffect = Fx.plasticExplosion; + frontColor = Pal.plastaniumFront; + backColor = Pal.plastaniumBack; + shootEffect = Fx.shootBig; + collidesGround = true; + explodeRange = 20f; + }}, + Items.surgeAlloy, new FlakBulletType(4.5f, 13){{ + ammoMultiplier = 5f; + splashDamage = 50f * 1.5f; + splashDamageRadius = 38f; + lightning = 2; + lightningLength = 7; + shootEffect = Fx.shootBig; + collidesGround = true; + explodeRange = 20f; + }} ); shootY = 8.75f; shoot = new ShootBarrel(){{ @@ -3176,9 +3543,41 @@ public class Blocks{ spectre = new ItemTurret("spectre"){{ requirements(Category.turret, with(Items.copper, 900, Items.graphite, 300, Items.surgeAlloy, 250, Items.plastanium, 175, Items.thorium, 250)); ammo( - Items.graphite, Bullets.standardDenseBig, - Items.pyratite, Bullets.standardIncendiaryBig, - Items.thorium, Bullets.standardThoriumBig + Items.graphite, new BasicBulletType(7.5f, 50){{ + hitSize = 4.8f; + width = 15f; + height = 21f; + shootEffect = Fx.shootBig; + ammoMultiplier = 4; + reloadMultiplier = 1.7f; + knockback = 0.3f; + }}, + Items.pyratite, new BasicBulletType(8f, 80){{ + hitSize = 5; + width = 16f; + height = 23f; + shootEffect = Fx.shootBig; + pierceCap = 2; + pierceBuilding = true; + knockback = 0.7f; + }}, + Items.thorium, new BasicBulletType(7f, 70){{ + hitSize = 5; + width = 16f; + height = 21f; + frontColor = Pal.lightishOrange; + backColor = Pal.lightOrange; + status = StatusEffects.burning; + hitEffect = new MultiEffect(Fx.hitBulletSmall, Fx.fireHit); + shootEffect = Fx.shootBig; + makeFire = true; + pierceCap = 2; + pierceBuilding = true; + knockback = 0.6f; + ammoMultiplier = 3; + splashDamage = 20f; + splashDamageRadius = 25f; + }} ); reload = 7f; coolantMultiplier = 0.5f; diff --git a/core/src/mindustry/content/Bullets.java b/core/src/mindustry/content/Bullets.java index bc1c3609fa..2f9b1deb31 100644 --- a/core/src/mindustry/content/Bullets.java +++ b/core/src/mindustry/content/Bullets.java @@ -8,30 +8,17 @@ import mindustry.graphics.*; public class Bullets{ public static BulletType - //artillery - artilleryDense, artilleryPlastic, artilleryPlasticFrag, artilleryHoming, artilleryIncendiary, artilleryExplosive, - - //flak - flakScrap, flakLead, flakGlass, flakGlassFrag, - - //frag (flak-like but hits ground) - fragGlass, fragExplosive, fragPlastic, fragSurge, fragGlassFrag, fragPlasticFrag, - - //missiles - missileExplosive, missileIncendiary, missileSurge, - - //standard - standardCopper, standardDense, standardThorium, standardHoming, standardIncendiary, - standardDenseBig, standardThoriumBig, standardIncendiaryBig, - - //liquid - waterShot, cryoShot, slagShot, oilShot, heavyWaterShot, heavyCryoShot, heavySlagShot, heavyOilShot, spaceLiquid, - - //environment, misc. - damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame; + placeholder, spaceLiquid, damageLightning, damageLightningGround, fireball; public static void load(){ + placeholder = new BasicBulletType(2.5f, 9, "ohno"){{ + width = 7f; + height = 9f; + lifetime = 60f; + ammoMultiplier = 2; + }}; + //lightning bullets need to be initialized first. damageLightning = new BulletType(0.0001f, 0f){{ lifetime = Fx.lightning.lifetime; @@ -47,435 +34,8 @@ public class Bullets{ damageLightningGround = damageLightning.copy(); damageLightningGround.collidesAir = false; - artilleryDense = new ArtilleryBulletType(3f, 20, "shell"){{ - hitEffect = Fx.flakExplosion; - knockback = 0.8f; - lifetime = 80f; - width = height = 11f; - collidesTiles = false; - splashDamageRadius = 25f * 0.75f; - splashDamage = 33f; - }}; - - artilleryPlasticFrag = new BasicBulletType(2.5f, 10, "bullet"){{ - width = 10f; - height = 12f; - shrinkY = 1f; - lifetime = 15f; - backColor = Pal.plastaniumBack; - frontColor = Pal.plastaniumFront; - despawnEffect = Fx.none; - collidesAir = false; - }}; - - artilleryPlastic = new ArtilleryBulletType(3.4f, 20, "shell"){{ - hitEffect = Fx.plasticExplosion; - knockback = 1f; - lifetime = 80f; - width = height = 13f; - collidesTiles = false; - splashDamageRadius = 35f * 0.75f; - splashDamage = 45f; - fragBullet = artilleryPlasticFrag; - fragBullets = 10; - backColor = Pal.plastaniumBack; - frontColor = Pal.plastaniumFront; - }}; - - artilleryHoming = new ArtilleryBulletType(3f, 20, "shell"){{ - hitEffect = Fx.flakExplosion; - knockback = 0.8f; - lifetime = 80f; - width = height = 11f; - collidesTiles = false; - splashDamageRadius = 25f * 0.75f; - splashDamage = 33f; - reloadMultiplier = 1.2f; - ammoMultiplier = 3f; - homingPower = 0.08f; - homingRange = 50f; - }}; - - artilleryIncendiary = new ArtilleryBulletType(3f, 20, "shell"){{ - hitEffect = Fx.blastExplosion; - knockback = 0.8f; - lifetime = 80f; - width = height = 13f; - collidesTiles = false; - splashDamageRadius = 25f * 0.75f; - splashDamage = 40f; - status = StatusEffects.burning; - statusDuration = 60f * 12f; - frontColor = Pal.lightishOrange; - backColor = Pal.lightOrange; - makeFire = true; - trailEffect = Fx.incendTrail; - ammoMultiplier = 4f; - }}; - - artilleryExplosive = new ArtilleryBulletType(2f, 20, "shell"){{ - hitEffect = Fx.blastExplosion; - knockback = 0.8f; - lifetime = 80f; - width = height = 14f; - collidesTiles = false; - ammoMultiplier = 4f; - splashDamageRadius = 45f * 0.75f; - splashDamage = 55f; - backColor = Pal.missileYellowBack; - frontColor = Pal.missileYellow; - - status = StatusEffects.blasted; - }}; - - flakGlassFrag = new BasicBulletType(3f, 5, "bullet"){{ - width = 5f; - height = 12f; - shrinkY = 1f; - lifetime = 20f; - backColor = Pal.gray; - frontColor = Color.white; - despawnEffect = Fx.none; - collidesGround = false; - }}; - - flakLead = new FlakBulletType(4.2f, 3){{ - lifetime = 60f; - ammoMultiplier = 4f; - shootEffect = Fx.shootSmall; - width = 6f; - height = 8f; - hitEffect = Fx.flakExplosion; - splashDamage = 27f * 1.5f; - splashDamageRadius = 15f; - }}; - - flakScrap = new FlakBulletType(4f, 3){{ - lifetime = 60f; - ammoMultiplier = 5f; - shootEffect = Fx.shootSmall; - reloadMultiplier = 0.5f; - width = 6f; - height = 8f; - hitEffect = Fx.flakExplosion; - splashDamage = 22f * 1.5f; - splashDamageRadius = 24f; - }}; - - flakGlass = new FlakBulletType(4f, 3){{ - lifetime = 60f; - ammoMultiplier = 5f; - shootEffect = Fx.shootSmall; - reloadMultiplier = 0.8f; - width = 6f; - height = 8f; - hitEffect = Fx.flakExplosion; - splashDamage = 25f * 1.5f; - splashDamageRadius = 20f; - fragBullet = flakGlassFrag; - fragBullets = 6; - }}; - - fragGlassFrag = new BasicBulletType(3f, 5, "bullet"){{ - width = 5f; - height = 12f; - shrinkY = 1f; - lifetime = 20f; - backColor = Pal.gray; - frontColor = Color.white; - despawnEffect = Fx.none; - }}; - - fragPlasticFrag = new BasicBulletType(2.5f, 12, "bullet"){{ - width = 10f; - height = 12f; - shrinkY = 1f; - lifetime = 15f; - backColor = Pal.plastaniumBack; - frontColor = Pal.plastaniumFront; - despawnEffect = Fx.none; - }}; - - fragGlass = new FlakBulletType(4f, 9){{ - ammoMultiplier = 3f; - shootEffect = Fx.shootSmall; - reloadMultiplier = 0.8f; - width = 6f; - height = 8f; - hitEffect = Fx.flakExplosion; - splashDamage = 28f * 1.5f; - splashDamageRadius = 22f; - fragBullet = fragGlassFrag; - fragBullets = 4; - explodeRange = 20f; - collidesGround = true; - }}; - - fragPlastic = new FlakBulletType(4f, 6){{ - splashDamageRadius = 40f; - splashDamage = 25f * 1.5f; - fragBullet = fragPlasticFrag; - fragBullets = 6; - hitEffect = Fx.plasticExplosion; - frontColor = Pal.plastaniumFront; - backColor = Pal.plastaniumBack; - shootEffect = Fx.shootBig; - collidesGround = true; - explodeRange = 20f; - }}; - - fragExplosive = new FlakBulletType(4f, 5){{ - shootEffect = Fx.shootBig; - ammoMultiplier = 5f; - splashDamage = 26f * 1.5f; - splashDamageRadius = 60f; - collidesGround = true; - - status = StatusEffects.blasted; - statusDuration = 60f; - }}; - - fragSurge = new FlakBulletType(4.5f, 13){{ - ammoMultiplier = 5f; - splashDamage = 50f * 1.5f; - splashDamageRadius = 38f; - lightning = 2; - lightningLength = 7; - shootEffect = Fx.shootBig; - collidesGround = true; - explodeRange = 20f; - }}; - - missileExplosive = new MissileBulletType(3.7f, 10){{ - width = 8f; - height = 8f; - shrinkY = 0f; - splashDamageRadius = 30f; - splashDamage = 30f * 1.5f; - ammoMultiplier = 5f; - hitEffect = Fx.blastExplosion; - despawnEffect = Fx.blastExplosion; - - status = StatusEffects.blasted; - statusDuration = 60f; - }}; - - missileIncendiary = new MissileBulletType(3.7f, 12){{ - frontColor = Pal.lightishOrange; - backColor = Pal.lightOrange; - width = 7f; - height = 8f; - shrinkY = 0f; - homingPower = 0.08f; - splashDamageRadius = 20f; - splashDamage = 30f * 1.5f; - makeFire = true; - ammoMultiplier = 5f; - hitEffect = Fx.blastExplosion; - status = StatusEffects.burning; - }}; - - missileSurge = new MissileBulletType(3.7f, 18){{ - width = 8f; - height = 8f; - shrinkY = 0f; - splashDamageRadius = 25f; - splashDamage = 25f * 1.4f; - hitEffect = Fx.blastExplosion; - despawnEffect = Fx.blastExplosion; - ammoMultiplier = 4f; - lightningDamage = 10; - lightning = 2; - lightningLength = 10; - }}; - - standardCopper = new BasicBulletType(2.5f, 9){{ - width = 7f; - height = 9f; - lifetime = 60f; - shootEffect = Fx.shootSmall; - smokeEffect = Fx.shootSmallSmoke; - ammoMultiplier = 2; - }}; - - standardDense = new BasicBulletType(3.5f, 18){{ - width = 9f; - height = 12f; - reloadMultiplier = 0.6f; - ammoMultiplier = 4; - lifetime = 60f; - }}; - - standardThorium = new BasicBulletType(4f, 29, "bullet"){{ - width = 10f; - height = 13f; - shootEffect = Fx.shootBig; - smokeEffect = Fx.shootBigSmoke; - ammoMultiplier = 4; - lifetime = 60f; - }}; - - standardHoming = new BasicBulletType(3f, 12, "bullet"){{ - width = 7f; - height = 9f; - homingPower = 0.1f; - reloadMultiplier = 1.5f; - ammoMultiplier = 5; - lifetime = 60f; - }}; - - standardIncendiary = new BasicBulletType(3.2f, 16, "bullet"){{ - width = 10f; - height = 12f; - frontColor = Pal.lightishOrange; - backColor = Pal.lightOrange; - status = StatusEffects.burning; - hitEffect = new MultiEffect(Fx.hitBulletSmall, Fx.fireHit); - - ammoMultiplier = 5; - - splashDamage = 12f; - splashDamageRadius = 22f; - - makeFire = true; - lifetime = 60f; - }}; - - standardDenseBig = new BasicBulletType(7.5f, 50, "bullet"){{ - hitSize = 4.8f; - width = 15f; - height = 21f; - shootEffect = Fx.shootBig; - ammoMultiplier = 4; - reloadMultiplier = 1.7f; - knockback = 0.3f; - }}; - - standardThoriumBig = new BasicBulletType(8f, 80, "bullet"){{ - hitSize = 5; - width = 16f; - height = 23f; - shootEffect = Fx.shootBig; - pierceCap = 2; - pierceBuilding = true; - knockback = 0.7f; - }}; - - standardIncendiaryBig = new BasicBulletType(7f, 70, "bullet"){{ - hitSize = 5; - width = 16f; - height = 21f; - frontColor = Pal.lightishOrange; - backColor = Pal.lightOrange; - status = StatusEffects.burning; - hitEffect = new MultiEffect(Fx.hitBulletSmall, Fx.fireHit); - shootEffect = Fx.shootBig; - makeFire = true; - pierceCap = 2; - pierceBuilding = true; - knockback = 0.6f; - ammoMultiplier = 3; - splashDamage = 20f; - splashDamageRadius = 25f; - }}; - fireball = new FireBulletType(1f, 4); - basicFlame = new BulletType(3.35f, 17f){{ - ammoMultiplier = 3f; - hitSize = 7f; - lifetime = 18f; - pierce = true; - collidesAir = false; - statusDuration = 60f * 4; - shootEffect = Fx.shootSmallFlame; - hitEffect = Fx.hitFlameSmall; - despawnEffect = Fx.none; - status = StatusEffects.burning; - keepVelocity = false; - hittable = false; - }}; - - pyraFlame = new BulletType(4f, 60f){{ - ammoMultiplier = 6f; - hitSize = 7f; - lifetime = 18f; - pierce = true; - collidesAir = false; - statusDuration = 60f * 10; - shootEffect = Fx.shootPyraFlame; - hitEffect = Fx.hitFlameSmall; - despawnEffect = Fx.none; - status = StatusEffects.burning; - hittable = false; - }}; - - waterShot = new LiquidBulletType(Liquids.water){{ - knockback = 0.7f; - drag = 0.01f; - }}; - - cryoShot = new LiquidBulletType(Liquids.cryofluid){{ - drag = 0.01f; - }}; - - slagShot = new LiquidBulletType(Liquids.slag){{ - damage = 4; - drag = 0.01f; - }}; - - oilShot = new LiquidBulletType(Liquids.oil){{ - drag = 0.01f; - }}; - - heavyWaterShot = new LiquidBulletType(Liquids.water){{ - lifetime = 49f; - speed = 4f; - knockback = 1.7f; - puddleSize = 8f; - orbSize = 4f; - drag = 0.001f; - ammoMultiplier = 0.4f; - statusDuration = 60f * 4f; - damage = 0.2f; - }}; - - heavyCryoShot = new LiquidBulletType(Liquids.cryofluid){{ - lifetime = 49f; - speed = 4f; - knockback = 1.3f; - puddleSize = 8f; - orbSize = 4f; - drag = 0.001f; - ammoMultiplier = 0.4f; - statusDuration = 60f * 4f; - damage = 0.2f; - }}; - - heavySlagShot = new LiquidBulletType(Liquids.slag){{ - lifetime = 49f; - speed = 4f; - knockback = 1.3f; - puddleSize = 8f; - orbSize = 4f; - damage = 4.75f; - drag = 0.001f; - ammoMultiplier = 0.4f; - statusDuration = 60f * 4f; - }}; - - heavyOilShot = new LiquidBulletType(Liquids.oil){{ - lifetime = 49f; - speed = 4f; - knockback = 1.3f; - puddleSize = 8f; - orbSize = 4f; - drag = 0.001f; - ammoMultiplier = 0.4f; - statusDuration = 60f * 4f; - damage = 0.2f; - }}; - spaceLiquid = new SpaceLiquidBulletType(){{ knockback = 0.7f; drag = 0.01f; diff --git a/core/src/mindustry/content/ErekirTechTree.java b/core/src/mindustry/content/ErekirTechTree.java index 0329377aac..16db94f4d9 100644 --- a/core/src/mindustry/content/ErekirTechTree.java +++ b/core/src/mindustry/content/ErekirTechTree.java @@ -36,12 +36,12 @@ public class ErekirTechTree{ for(var bullet : item.ammoTypes.values()){ rebalanceBullet(bullet); } - }else if(turret instanceof ContinuousTurret cont){ - rebalanceBullet(cont.shootType); }else if(turret instanceof ContinuousLiquidTurret cont){ for(var bullet : cont.ammoTypes.values()){ rebalanceBullet(bullet); } + }else if(turret instanceof ContinuousTurret cont){ + rebalanceBullet(cont.shootType); } } } diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index b1b546b2e6..dff8f75764 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -101,7 +101,11 @@ public class UnitTypes{ y = 2f; top = false; ejectEffect = Fx.casing1; - bullet = Bullets.standardCopper; + bullet = new BasicBulletType(2.5f, 9){{ + width = 7f; + height = 9f; + lifetime = 60f; + }}; }}); }}; @@ -185,6 +189,12 @@ public class UnitTypes{ singleTarget = true; drownTimeMultiplier = 4f; + BulletType smallBullet = new BasicBulletType(3f, 10){{ + width = 7f; + height = 9f; + lifetime = 50f; + }}; + weapons.add( new Weapon("scepter-weapon"){{ top = false; @@ -220,7 +230,7 @@ public class UnitTypes{ y = 6f; rotate = true; ejectEffect = Fx.casing1; - bullet = Bullets.standardCopper; + bullet = smallBullet; }}, new Weapon("mount-weapon"){{ reload = 16f; @@ -228,9 +238,8 @@ public class UnitTypes{ y = -7f; rotate = true; ejectEffect = Fx.casing1; - bullet = Bullets.standardCopper; + bullet = smallBullet; }} - ); }}; @@ -1482,7 +1491,12 @@ public class UnitTypes{ y = 1.5f; rotate = true; ejectEffect = Fx.casing1; - bullet = Bullets.standardCopper; + bullet = new BasicBulletType(2.5f, 9){{ + width = 7f; + height = 9f; + lifetime = 60f; + ammoMultiplier = 2; + }}; }}); weapons.add(new Weapon("missiles-mount"){{ @@ -1539,7 +1553,16 @@ public class UnitTypes{ inaccuracy = 8f; ejectEffect = Fx.casing1; shootSound = Sounds.shoot; - bullet = Bullets.flakLead; + bullet = new FlakBulletType(4.2f, 3){{ + lifetime = 60f; + ammoMultiplier = 4f; + shootEffect = Fx.shootSmall; + width = 6f; + height = 8f; + hitEffect = Fx.flakExplosion; + splashDamage = 27f * 1.5f; + splashDamageRadius = 15f; + }}; }}); weapons.add(new Weapon("artillery-mount"){{ diff --git a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java index 1b9c76a7f4..79415b6470 100644 --- a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java +++ b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java @@ -16,6 +16,7 @@ public class ArtilleryBulletType extends BasicBulletType{ scaleVelocity = true; hitShake = 1f; hitSound = Sounds.explosion; + hitEffect = Fx.flakExplosion; shootEffect = Fx.shootBig; trailEffect = Fx.artilleryTrail; diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 28dde56f3c..0c2af1210e 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -423,6 +423,14 @@ public class UnitType extends UnlockableContent{ } } + /* + for(int i = 0; i < weapons.size; i++){ + var wep = weapons.get(i); + if(wep.bullet == Bullets.placeholder || wep.bullet == null){ + throw new RuntimeException("Unit: " + name + ": weapon #" + i + " ('" + wep.name + "') does not have a bullet defined. Make sure you have a bullet: (JSON) or `bullet = ` field in your unit definition."); + } + }*/ + if(pathCost == null){ pathCost = example instanceof WaterMovec ? ControlPathfinder.costNaval : diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 94c48a9b2a..4a2a4d0e19 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -10,6 +10,7 @@ import arc.math.geom.*; import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; +import mindustry.annotations.Annotations.*; import mindustry.audio.*; import mindustry.content.*; import mindustry.entities.*; @@ -27,7 +28,7 @@ public class Weapon implements Cloneable{ /** displayed weapon region */ public String name; /** bullet shot */ - public BulletType bullet = Bullets.standardCopper; + public BulletType bullet = Bullets.placeholder; /** shell ejection effect */ public Effect ejectEffect = Fx.none; /** whether to consume ammo when ammo is enabled in rules */ @@ -427,6 +428,7 @@ public class Weapon implements Cloneable{ } } + @CallSuper public void init(){ } diff --git a/core/src/mindustry/type/weapons/RepairBeamWeapon.java b/core/src/mindustry/type/weapons/RepairBeamWeapon.java index 2de8102e53..9f98374be0 100644 --- a/core/src/mindustry/type/weapons/RepairBeamWeapon.java +++ b/core/src/mindustry/type/weapons/RepairBeamWeapon.java @@ -174,6 +174,7 @@ public class RepairBeamWeapon extends Weapon{ @Override public void init(){ + super.init(); bullet.healPercent = fractionRepairSpeed; } diff --git a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java index 1b599cde4f..92da51d6d3 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java @@ -11,7 +11,7 @@ import mindustry.world.meta.*; /** A turret that fires a continuous beam bullet with no reload or coolant necessary. The bullet only disappears when the turret stops shooting. */ public class ContinuousTurret extends Turret{ - public BulletType shootType = Bullets.standardCopper; + public BulletType shootType = Bullets.placeholder; public ContinuousTurret(String name){ super(name);