Fixed crude turret icons
This commit is contained in:
@@ -157,7 +157,7 @@ public class TurretBlocks extends BlockList implements ContentList {
|
||||
size = 3;
|
||||
}};
|
||||
|
||||
spectre = new ItemTurret("eraser") {{
|
||||
spectre = new ItemTurret("spectre") {{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
|
||||
reload = 25f;
|
||||
restitution = 0.03f;
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.defense.turrets.Turret;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.mindustry.world.meta.StatCategory;
|
||||
@@ -364,7 +365,13 @@ public class BlocksFragment implements Fragment{
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
|
||||
table.table(title -> {
|
||||
title.addImage(Draw.region("block-icon-" + block.name)).size(8 * 6);
|
||||
int size = 8*6;
|
||||
|
||||
if(block instanceof Turret){
|
||||
size = (8 * block.size + 2) * (7 - block.size*2);
|
||||
}
|
||||
|
||||
title.addImage(Draw.region("block-icon-" + block.name)).size(size);
|
||||
title.add("[accent]" + block.formalName).padLeft(5);
|
||||
});
|
||||
|
||||
|
||||
@@ -374,10 +374,7 @@ public class Block extends BaseBlock implements UnlockableContent{
|
||||
/**Returns a list of icon regions that have been cropped to 8x8*/
|
||||
public TextureRegion[] getCompactIcon(){
|
||||
if(compactIcon == null) {
|
||||
compactIcon = new TextureRegion[getIcon().length];
|
||||
for (int i = 0; i < compactIcon.length; i++) {
|
||||
compactIcon[i] = iconRegion(getIcon()[i]);
|
||||
}
|
||||
compactIcon = new TextureRegion[]{iconRegion(Draw.region("block-icon-" + name))};
|
||||
}
|
||||
return compactIcon;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class LiquidTurret extends Turret {
|
||||
public void setStats() {
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.inputItems, new LiquidFilterValue(item -> liquidAmmoMap.containsKey(item)));
|
||||
stats.add(BlockStat.inputLiquid, new LiquidFilterValue(item -> liquidAmmoMap.containsKey(item)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,15 +56,20 @@ public abstract class Turret extends Block{
|
||||
protected float rotatespeed = 5f; //in degrees per tick
|
||||
protected float shootCone = 8f;
|
||||
protected float shootShake = 0f;
|
||||
|
||||
protected Translator tr = new Translator();
|
||||
protected Translator tr2 = new Translator();
|
||||
protected String base = null; //name of the region to draw under turret, usually null
|
||||
|
||||
protected TextureRegion baseRegion;
|
||||
protected TextureRegion heatRegion;
|
||||
protected TextureRegion baseTopRegion;
|
||||
|
||||
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
protected BiConsumer<Tile, TurretEntity> heatDrawer = (tile, entity) ->{
|
||||
Graphics.setAdditiveBlending();
|
||||
Draw.color(heatColor);
|
||||
Draw.alpha(entity.heat);
|
||||
Draw.rect(name + "-heat", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
Draw.rect(heatRegion, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
Graphics.setNormalBlending();
|
||||
};
|
||||
|
||||
@@ -82,6 +87,15 @@ public abstract class Turret extends Block{
|
||||
viewRange = range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
|
||||
baseRegion = Draw.region("block-" + size);
|
||||
baseTopRegion = Draw.region("block-" +size + "-top");
|
||||
heatRegion = Draw.region(name + "-heat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
@@ -98,16 +112,10 @@ public abstract class Turret extends Block{
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
if(base == null) {
|
||||
Draw.rect("block-" + size, tile.drawx(), tile.drawy());
|
||||
if(Draw.hasRegion("block-" + size + "-top")) {
|
||||
Draw.color(tile.getTeam().color, Color.WHITE, 0.45f);
|
||||
Draw.rect("block-" + size + "-top", tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
}
|
||||
}else{
|
||||
Draw.rect(base, tile.drawx(), tile.drawy());
|
||||
}
|
||||
Draw.rect(baseRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color(tile.getTeam().color, Color.WHITE, 0.45f);
|
||||
Draw.rect(baseTopRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,11 +136,11 @@ public abstract class Turret extends Block{
|
||||
@Override
|
||||
public TextureRegion[] getBlockIcon(){
|
||||
if(blockIcon == null){
|
||||
blockIcon = Draw.hasRegion(name) ? new TextureRegion[]{Draw.region("block-" + size), Draw.region(name)} : new TextureRegion[0];
|
||||
blockIcon = new TextureRegion[]{Draw.region("block-icon-" + name)};
|
||||
}
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
Draw.color(tile.getTeam().color);
|
||||
|
||||
Reference in New Issue
Block a user