From 10d8e63368476675a3c1d435cbb63a3184ab5a18 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 10 Jan 2022 14:01:30 -0500 Subject: [PATCH] Multi-liquid sublimate --- build.gradle | 2 +- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/content/Blocks.java | 31 ++++-- .../mindustry/entities/bullet/BulletType.java | 8 +- .../bullet/ContinuousFlameBulletType.java | 2 + .../maps/planet/ErekirPlanetGenerator.java | 2 +- .../turrets/ContinuousLiquidTurret.java | 94 +++++++++++++++++++ .../defense/turrets/ContinuousTurret.java | 10 +- .../blocks/defense/turrets/LiquidTurret.java | 6 +- core/src/mindustry/world/meta/StatValues.java | 4 + 10 files changed, 140 insertions(+), 20 deletions(-) create mode 100644 core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java diff --git a/build.gradle b/build.gradle index f61001f29d..cb36337642 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ buildscript{ } dependencies{ - classpath "com.mobidevelop.robovm:robovm-gradle-plugin:2.3.14" + classpath "com.mobidevelop.robovm:robovm-gradle-plugin:2.3.15" classpath "com.github.Anuken.Arc:packer:$arcHash" classpath "com.github.Anuken.Arc:arc-core:$arcHash" } diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 3f5118cf97..e098f93605 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -831,6 +831,7 @@ bullet.damage = [stat]{0}[lightgray] damage bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles bullet.incendiary = [stat]incendiary bullet.homing = [stat]homing +bullet.armorpierce = [stat]armor piercing bullet.frags = [stat]{0}[lightgray]x frag bullets: bullet.lightning = [stat]{0}[lightgray]x lightning ~ [stat]{1}[lightgray] damage bullet.buildingdamage = [stat]{0}%[lightgray] building damage diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 98e2c5f17b..63a83f4245 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1034,7 +1034,7 @@ public class Blocks{ drawer.iconOverride = new String[]{"-bottom", ""}; continuousLiquidOutput = true; - outputLiquids = LiquidStack.with(Liquids.ozone, 2f * 2f / 60, Liquids.hydrogen, 2f * 3f / 60); + outputLiquids = LiquidStack.with(Liquids.ozone, 4f / 60, Liquids.hydrogen, 6f / 60); liquidOutputDirections = new int[]{1, 3}; }}; @@ -2991,12 +2991,11 @@ public class Blocks{ }}; //TODO bad name - sublimate = new ContinuousTurret("sublimate"){{ + sublimate = new ContinuousLiquidTurret("sublimate"){{ //TODO requirements requirements(Category.turret, with(Items.tungsten, 150, Items.silicon, 160, Items.oxide, 50, Items.beryllium, 200)); draw = new DrawTurret("reinforced-"){{ - liquidDraw = Liquids.ozone; Color heatc = Color.valueOf("fa2859"); heatColor = heatc; @@ -3029,15 +3028,29 @@ public class Blocks{ }}; outlineColor = Pal.darkOutline; - //TODO also consume hydrogen as a different ammo - consumes.liquids(LiquidStack.with(Liquids.cyanogen, 3f / 60f, Liquids.ozone, 2f / 60f)); + liquidConsumed = 4f / 60f; - range = 170f; + range = 130f; - shootType = new ContinuousFlameBulletType(){{ - damage = 5f; + //TODO balance, set up, where is liquid/sec displayed? status effects maybe? + ammo( + Liquids.ozone, new ContinuousFlameBulletType(){{ + damage = 7f; length = range; - }}; + + colors = new Color[]{Color.valueOf("eb7abe").a(0.55f), Color.valueOf("e189f5").a(0.7f), Color.valueOf("907ef7").a(0.8f), Color.valueOf("91a4ff"), Color.white}; + }}, + Liquids.cyanogen, new ContinuousFlameBulletType(){{ + damage = 14f; + rangeChange = 50f; + length = range + rangeChange; + + colors = new Color[]{Color.valueOf("465ab8").a(0.55f), Color.valueOf("66a6d2").a(0.7f), Color.valueOf("89e8b6").a(0.8f), Color.valueOf("cafcbe"), Color.white}; + flareColor = Color.valueOf("89e8b6"); + + lightColor = hitColor = flareColor; + }} + ); acceptCoolant = false; scaledHealth = 320; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 97334567f1..6599f1fce5 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -124,6 +124,8 @@ public class BulletType extends Content implements Cloneable{ public boolean makeFire = false; /** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. */ public boolean despawnHit = false; + /** If true, unit armor is ignored in damage calculations. Ignored for building armor. */ + public boolean pierceArmor = false; //additional effects @@ -246,7 +248,11 @@ public class BulletType extends Content implements Cloneable{ public void hitEntity(Bullet b, Hitboxc entity, float health){ if(entity instanceof Healthc h){ - h.damage(b.damage); + if(pierceArmor){ + h.damagePierce(b.damage); + }else{ + h.damage(b.damage); + } } if(entity instanceof Unit unit){ diff --git a/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java b/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java index 9270be2a6b..733cc9f623 100644 --- a/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java +++ b/core/src/mindustry/entities/bullet/ContinuousFlameBulletType.java @@ -50,6 +50,8 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{ hitColor = colors[1].cpy().a(1f); lightColor = hitColor; laserAbsorb = false; + ammoMultiplier = 1f; + pierceArmor = true; } @Override diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index 658f2f175e..95d4831ca2 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -75,7 +75,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ if(ice < 0.6){ if(result == Blocks.rhyolite || result == Blocks.yellowStone || result == Blocks.regolith){ - return Blocks.redIce; + return Blocks.dacite; //TODO perhaps something else } } diff --git a/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java new file mode 100644 index 0000000000..7db7a37198 --- /dev/null +++ b/core/src/mindustry/world/blocks/defense/turrets/ContinuousLiquidTurret.java @@ -0,0 +1,94 @@ +package mindustry.world.blocks.defense.turrets; + +import arc.struct.*; +import mindustry.content.*; +import mindustry.entities.bullet.*; +import mindustry.gen.*; +import mindustry.type.*; +import mindustry.world.consumers.*; +import mindustry.world.meta.*; + +public class ContinuousLiquidTurret extends ContinuousTurret{ + public ObjectMap ammoTypes = new ObjectMap<>(); + public float liquidConsumed = 1f / 60f; + + public ContinuousLiquidTurret(String name){ + super(name); + acceptCoolant = false; + hasLiquids = true; + //TODO + loopSound = Sounds.minebeam; + shootSound = Sounds.none; + smokeEffect = Fx.none; + shootEffect = Fx.none; + } + + /** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */ + public void ammo(Object... objects){ + ammoTypes = ObjectMap.of(objects); + } + + @Override + public void setStats(){ + super.setStats(); + + stats.remove(Stat.ammo); + stats.add(Stat.ammo, StatValues.ammo(ammoTypes)); + } + + @Override + public void init(){ + //TODO use ammoMultiplier here? + consumes.add(new ConsumeLiquidFilter(i -> ammoTypes.containsKey(i), liquidConsumed){ + @Override + public boolean valid(Building build){ + return build.liquids.currentAmount() >= use(build); + } + + @Override + public void display(Stats stats){ + + } + }); + + super.init(); + } + + public class LiquidTurretBuild extends ContinuousTurretBuild{ + + @Override + public boolean shouldActiveSound(){ + return wasShooting && enabled; + } + + @Override + public void updateTile(){ + unit.ammo(unit.type().ammoCapacity * liquids.currentAmount() / liquidCapacity); + + super.updateTile(); + } + + @Override + public BulletType useAmmo(){ + //does not consume ammo upon firing + return peekAmmo(); + } + + @Override + public BulletType peekAmmo(){ + return ammoTypes.get(liquids.current()); + } + + @Override + public boolean acceptItem(Building source, Item item){ + return false; + } + + @Override + public boolean acceptLiquid(Building source, Liquid liquid){ + return ammoTypes.get(liquid) != null && + (liquids.current() == liquid || + ((!ammoTypes.containsKey(liquids.current()) || liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f))); + } + } +} diff --git a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java index d52fca935c..131eb496c9 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/ContinuousTurret.java @@ -2,6 +2,7 @@ package mindustry.world.blocks.defense.turrets; import arc.math.*; import arc.struct.*; +import mindustry.content.*; import mindustry.entities.bullet.*; import mindustry.gen.*; import mindustry.logic.*; @@ -10,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; + public BulletType shootType = Bullets.standardCopper; public ContinuousTurret(String name){ super(name); @@ -81,7 +82,7 @@ public class ContinuousTurret extends Turret{ heat = 1f; recoil = recoilAmount; - if(isShooting()){ + if(isShooting() && hasAmmo()){ bullet.time = bullet.lifetime * bullet.type.optimalLifeFract * shootWarmup; } } @@ -106,9 +107,8 @@ public class ContinuousTurret extends Turret{ return; } - if((consValid() || cheating()) && !charging){ - BulletType type = peekAmmo(); - shoot(type); + if(consValid() && !charging){ + shoot(peekAmmo()); } } diff --git a/core/src/mindustry/world/blocks/defense/turrets/LiquidTurret.java b/core/src/mindustry/world/blocks/defense/turrets/LiquidTurret.java index 8b0fd34208..04b055c3bf 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/LiquidTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/LiquidTurret.java @@ -137,9 +137,9 @@ public class LiquidTurret extends Turret{ @Override public boolean acceptLiquid(Building source, Liquid liquid){ - return ammoTypes.get(liquid) != null - && (liquids.current() == liquid || (ammoTypes.containsKey(liquid) - && (!ammoTypes.containsKey(liquids.current()) || liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f))); + return ammoTypes.get(liquid) != null && + (liquids.current() == liquid || + ((!ammoTypes.containsKey(liquids.current()) || liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f))); } } } diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 1e6cb788be..3c2bb8a291 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -349,6 +349,10 @@ public class StatValues{ sep(bt, Core.bundle.format("bullet.lightning", type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage)); } + if(type.pierceArmor){ + sep(bt, "@bullet.armorpierce"); + } + if(type.status != StatusEffects.none){ sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName); }