Makes the top sprite visible on liquid turret icons (#4683)
* Add top region to liquid turret icons * Attempt to change outline icon generation * Draw regions above the outlined icon over it * Draw regions **above** the outlined icon over it * Add clarrifying comment * Implement backwards compatibility for mods * an -> any
This commit is contained in:
committed by
GitHub
parent
557e5710cd
commit
7a21c02476
@@ -160,8 +160,10 @@ public class Block extends UnlockableContent{
|
||||
public boolean canOverdrive = true;
|
||||
/** Outlined icon color.*/
|
||||
public Color outlineColor = Color.valueOf("404049");
|
||||
/** Whether the icon region has an outline added. */
|
||||
/** Whether any icon region has an outline added. */
|
||||
public boolean outlineIcon = false;
|
||||
/** Which of the icon regions gets the outline added. */
|
||||
public int outlinedIcon = -1;
|
||||
/** Whether this block has a shadow under it. */
|
||||
public boolean hasShadow = true;
|
||||
/** Sounds made when this block breaks.*/
|
||||
@@ -768,7 +770,7 @@ public class Block extends UnlockableContent{
|
||||
|
||||
if(outlineIcon){
|
||||
final int radius = 4;
|
||||
PixmapRegion region = Core.atlas.getPixmap(getGeneratedIcons()[getGeneratedIcons().length-1]);
|
||||
PixmapRegion region = Core.atlas.getPixmap(getGeneratedIcons()[outlinedIcon >= 0 ? outlinedIcon : getGeneratedIcons().length -1]);
|
||||
Pixmap out = new Pixmap(region.width, region.height);
|
||||
Color color = new Color();
|
||||
for(int x = 0; x < region.width; x++){
|
||||
|
||||
@@ -27,6 +27,7 @@ public class LiquidTurret extends Turret{
|
||||
hasLiquids = true;
|
||||
loopSound = Sounds.spray;
|
||||
shootSound = Sounds.none;
|
||||
outlinedIcon = 1;
|
||||
}
|
||||
|
||||
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
|
||||
@@ -63,6 +64,12 @@ public class LiquidTurret extends Turret{
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
if(topRegion.found()) return new TextureRegion[]{baseRegion, region, topRegion};
|
||||
return super.icons();
|
||||
}
|
||||
|
||||
public class LiquidTurretBuild extends TurretBuild{
|
||||
@Override
|
||||
public void draw(){
|
||||
|
||||
@@ -247,7 +247,7 @@ public class Generators{
|
||||
Image last = null;
|
||||
if(block.outlineIcon){
|
||||
int radius = 4;
|
||||
GenRegion region = (GenRegion)regions[regions.length - 1];
|
||||
GenRegion region = (GenRegion)regions[block.outlinedIcon >= 0 ? block.outlinedIcon : regions.length -1];
|
||||
Image base = ImagePacker.get(region);
|
||||
Image out = last = new Image(region.width, region.height);
|
||||
for(int x = 0; x < out.width; x++){
|
||||
@@ -273,6 +273,14 @@ public class Generators{
|
||||
}
|
||||
}
|
||||
|
||||
//do not run for legacy ones
|
||||
if(block.outlinedIcon >= 0){
|
||||
//prevents the regions above from being ignored/invisible/etc
|
||||
for(int i = block.outlinedIcon + 1; i < regions.length; i++){
|
||||
out.draw(ImagePacker.get(regions[i]));
|
||||
}
|
||||
}
|
||||
|
||||
region.path.delete();
|
||||
|
||||
out.save(block.name);
|
||||
|
||||
Reference in New Issue
Block a user