mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-11 08:15:35 +03:00
Multi-liquid sublimate
This commit is contained in:
parent
5509104a44
commit
10d8e63368
@ -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"
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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){
|
||||
|
@ -50,6 +50,8 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
hitColor = colors[1].cpy().a(1f);
|
||||
lightColor = hitColor;
|
||||
laserAbsorb = false;
|
||||
ammoMultiplier = 1f;
|
||||
pierceArmor = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user