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;
|
public boolean canOverdrive = true;
|
||||||
/** Outlined icon color.*/
|
/** Outlined icon color.*/
|
||||||
public Color outlineColor = Color.valueOf("404049");
|
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;
|
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. */
|
/** Whether this block has a shadow under it. */
|
||||||
public boolean hasShadow = true;
|
public boolean hasShadow = true;
|
||||||
/** Sounds made when this block breaks.*/
|
/** Sounds made when this block breaks.*/
|
||||||
@@ -768,7 +770,7 @@ public class Block extends UnlockableContent{
|
|||||||
|
|
||||||
if(outlineIcon){
|
if(outlineIcon){
|
||||||
final int radius = 4;
|
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);
|
Pixmap out = new Pixmap(region.width, region.height);
|
||||||
Color color = new Color();
|
Color color = new Color();
|
||||||
for(int x = 0; x < region.width; x++){
|
for(int x = 0; x < region.width; x++){
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class LiquidTurret extends Turret{
|
|||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
loopSound = Sounds.spray;
|
loopSound = Sounds.spray;
|
||||||
shootSound = Sounds.none;
|
shootSound = Sounds.none;
|
||||||
|
outlinedIcon = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
|
/** Initializes accepted ammo map. Format: [liquid1, bullet1, liquid2, bullet2...] */
|
||||||
@@ -63,6 +64,12 @@ public class LiquidTurret extends Turret{
|
|||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] icons(){
|
||||||
|
if(topRegion.found()) return new TextureRegion[]{baseRegion, region, topRegion};
|
||||||
|
return super.icons();
|
||||||
|
}
|
||||||
|
|
||||||
public class LiquidTurretBuild extends TurretBuild{
|
public class LiquidTurretBuild extends TurretBuild{
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ public class Generators{
|
|||||||
Image last = null;
|
Image last = null;
|
||||||
if(block.outlineIcon){
|
if(block.outlineIcon){
|
||||||
int radius = 4;
|
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 base = ImagePacker.get(region);
|
||||||
Image out = last = new Image(region.width, region.height);
|
Image out = last = new Image(region.width, region.height);
|
||||||
for(int x = 0; x < out.width; x++){
|
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();
|
region.path.delete();
|
||||||
|
|
||||||
out.save(block.name);
|
out.save(block.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user