mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-16 02:38:37 +07:00
Added default liquid turret liquid display
This commit is contained in:
@ -1388,15 +1388,6 @@ public class Blocks implements ContentList{
|
|||||||
range = 110f;
|
range = 110f;
|
||||||
health = 250 * size * size;
|
health = 250 * size * size;
|
||||||
shootSound = Sounds.splash;
|
shootSound = Sounds.splash;
|
||||||
|
|
||||||
drawer = (tile, entity) -> {
|
|
||||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
|
||||||
|
|
||||||
Draw.color(entity.liquids.current().color);
|
|
||||||
Draw.alpha(entity.liquids.total() / liquidCapacity);
|
|
||||||
Draw.rect(name + "-liquid", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
|
||||||
Draw.color();
|
|
||||||
};
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
lancer = new ChargeTurret("lancer"){{
|
lancer = new ChargeTurret("lancer"){{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package mindustry.world.blocks.defense.turrets;
|
package mindustry.world.blocks.defense.turrets;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.entities.bullet.*;
|
import mindustry.entities.bullet.*;
|
||||||
@ -16,11 +18,13 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
public class LiquidTurret extends Turret{
|
public class LiquidTurret extends Turret{
|
||||||
public ObjectMap<Liquid, BulletType> ammo = new ObjectMap<>();
|
public ObjectMap<Liquid, BulletType> ammo = new ObjectMap<>();
|
||||||
|
public int liquidRegion;
|
||||||
|
|
||||||
public LiquidTurret(String name){
|
public LiquidTurret(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
activeSound = Sounds.spray;
|
activeSound = Sounds.spray;
|
||||||
|
liquidRegion = reg("-liquid");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
|
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
|
||||||
@ -28,6 +32,19 @@ public class LiquidTurret extends Turret{
|
|||||||
ammo = OrderedMap.of(objects);
|
ammo = OrderedMap.of(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLayer(Tile tile){
|
||||||
|
super.drawLayer(tile);
|
||||||
|
TurretEntity entity = tile.ent();
|
||||||
|
|
||||||
|
if(Core.atlas.isFound(reg(liquidRegion))){
|
||||||
|
Draw.color(entity.liquids.current().color);
|
||||||
|
Draw.alpha(entity.liquids.total() / liquidCapacity);
|
||||||
|
Draw.rect(reg(liquidRegion), tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStats(){
|
public void setStats(){
|
||||||
super.setStats();
|
super.setStats();
|
||||||
|
Reference in New Issue
Block a user