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:
Patrick 'Quezler' Mounier
2021-02-15 15:32:46 +01:00
committed by GitHub
parent 557e5710cd
commit 7a21c02476
3 changed files with 20 additions and 3 deletions

View File

@@ -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++){

View File

@@ -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(){