Multi-liquid sublimate

This commit is contained in:
Anuken
2022-01-10 14:01:30 -05:00
parent 5509104a44
commit 10d8e63368
10 changed files with 140 additions and 20 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ buildscript{
} }
dependencies{ 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:packer:$arcHash"
classpath "com.github.Anuken.Arc:arc-core:$arcHash" classpath "com.github.Anuken.Arc:arc-core:$arcHash"
} }
+1
View File
@@ -831,6 +831,7 @@ bullet.damage = [stat]{0}[lightgray] damage
bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles
bullet.incendiary = [stat]incendiary bullet.incendiary = [stat]incendiary
bullet.homing = [stat]homing bullet.homing = [stat]homing
bullet.armorpierce = [stat]armor piercing
bullet.frags = [stat]{0}[lightgray]x frag bullets: bullet.frags = [stat]{0}[lightgray]x frag bullets:
bullet.lightning = [stat]{0}[lightgray]x lightning ~ [stat]{1}[lightgray] damage bullet.lightning = [stat]{0}[lightgray]x lightning ~ [stat]{1}[lightgray] damage
bullet.buildingdamage = [stat]{0}%[lightgray] building damage bullet.buildingdamage = [stat]{0}%[lightgray] building damage
+22 -9
View File
@@ -1034,7 +1034,7 @@ public class Blocks{
drawer.iconOverride = new String[]{"-bottom", ""}; drawer.iconOverride = new String[]{"-bottom", ""};
continuousLiquidOutput = true; 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}; liquidOutputDirections = new int[]{1, 3};
}}; }};
@@ -2991,12 +2991,11 @@ public class Blocks{
}}; }};
//TODO bad name //TODO bad name
sublimate = new ContinuousTurret("sublimate"){{ sublimate = new ContinuousLiquidTurret("sublimate"){{
//TODO requirements //TODO requirements
requirements(Category.turret, with(Items.tungsten, 150, Items.silicon, 160, Items.oxide, 50, Items.beryllium, 200)); requirements(Category.turret, with(Items.tungsten, 150, Items.silicon, 160, Items.oxide, 50, Items.beryllium, 200));
draw = new DrawTurret("reinforced-"){{ draw = new DrawTurret("reinforced-"){{
liquidDraw = Liquids.ozone;
Color heatc = Color.valueOf("fa2859"); Color heatc = Color.valueOf("fa2859");
heatColor = heatc; heatColor = heatc;
@@ -3029,15 +3028,29 @@ public class Blocks{
}}; }};
outlineColor = Pal.darkOutline; outlineColor = Pal.darkOutline;
//TODO also consume hydrogen as a different ammo liquidConsumed = 4f / 60f;
consumes.liquids(LiquidStack.with(Liquids.cyanogen, 3f / 60f, Liquids.ozone, 2f / 60f));
range = 170f; range = 130f;
shootType = new ContinuousFlameBulletType(){{ //TODO balance, set up, where is liquid/sec displayed? status effects maybe?
damage = 5f; ammo(
Liquids.ozone, new ContinuousFlameBulletType(){{
damage = 7f;
length = range; 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; acceptCoolant = false;
scaledHealth = 320; scaledHealth = 320;
@@ -124,6 +124,8 @@ public class BulletType extends Content implements Cloneable{
public boolean makeFire = false; public boolean makeFire = false;
/** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. */ /** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. */
public boolean despawnHit = false; public boolean despawnHit = false;
/** If true, unit armor is ignored in damage calculations. Ignored for building armor. */
public boolean pierceArmor = false;
//additional effects //additional effects
@@ -246,7 +248,11 @@ public class BulletType extends Content implements Cloneable{
public void hitEntity(Bullet b, Hitboxc entity, float health){ public void hitEntity(Bullet b, Hitboxc entity, float health){
if(entity instanceof Healthc h){ 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){ if(entity instanceof Unit unit){
@@ -50,6 +50,8 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
hitColor = colors[1].cpy().a(1f); hitColor = colors[1].cpy().a(1f);
lightColor = hitColor; lightColor = hitColor;
laserAbsorb = false; laserAbsorb = false;
ammoMultiplier = 1f;
pierceArmor = true;
} }
@Override @Override
@@ -75,7 +75,7 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
if(ice < 0.6){ if(ice < 0.6){
if(result == Blocks.rhyolite || result == Blocks.yellowStone || result == Blocks.regolith){ if(result == Blocks.rhyolite || result == Blocks.yellowStone || result == Blocks.regolith){
return Blocks.redIce; return Blocks.dacite; //TODO perhaps something else
} }
} }
@@ -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<Liquid, BulletType> 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)));
}
}
}
@@ -2,6 +2,7 @@ package mindustry.world.blocks.defense.turrets;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
import mindustry.content.*;
import mindustry.entities.bullet.*; import mindustry.entities.bullet.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.logic.*; 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. */ /** 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 class ContinuousTurret extends Turret{
public BulletType shootType; public BulletType shootType = Bullets.standardCopper;
public ContinuousTurret(String name){ public ContinuousTurret(String name){
super(name); super(name);
@@ -81,7 +82,7 @@ public class ContinuousTurret extends Turret{
heat = 1f; heat = 1f;
recoil = recoilAmount; recoil = recoilAmount;
if(isShooting()){ if(isShooting() && hasAmmo()){
bullet.time = bullet.lifetime * bullet.type.optimalLifeFract * shootWarmup; bullet.time = bullet.lifetime * bullet.type.optimalLifeFract * shootWarmup;
} }
} }
@@ -106,9 +107,8 @@ public class ContinuousTurret extends Turret{
return; return;
} }
if((consValid() || cheating()) && !charging){ if(consValid() && !charging){
BulletType type = peekAmmo(); shoot(peekAmmo());
shoot(type);
} }
} }
@@ -137,9 +137,9 @@ public class LiquidTurret extends Turret{
@Override @Override
public boolean acceptLiquid(Building source, Liquid liquid){ public boolean acceptLiquid(Building source, Liquid liquid){
return ammoTypes.get(liquid) != null return ammoTypes.get(liquid) != null &&
&& (liquids.current() == liquid || (ammoTypes.containsKey(liquid) (liquids.current() == liquid ||
&& (!ammoTypes.containsKey(liquids.current()) || liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f))); ((!ammoTypes.containsKey(liquids.current()) || liquids.get(liquids.current()) <= 1f / ammoTypes.get(liquids.current()).ammoMultiplier + 0.001f)));
} }
} }
} }
@@ -349,6 +349,10 @@ public class StatValues{
sep(bt, Core.bundle.format("bullet.lightning", type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage)); 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){ if(type.status != StatusEffects.none){
sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName); sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName);
} }