Misc fixes for mods

This commit is contained in:
Anuken 2022-05-13 22:23:50 -04:00
parent ad5e4f2556
commit b66283fbd0
3 changed files with 14 additions and 10 deletions

View file

@ -611,6 +611,16 @@ public class UnitType extends UnlockableContent{
}
}
//never actually called; it turns out certain mods have custom weapons that do not need bullets.
protected void validateWeapons(){
for(int i = 0; i < weapons.size; i++){
var wep = weapons.get(i);
if(wep.bullet == Bullets.placeholder || wep.bullet == null){
throw new RuntimeException("Unit: " + name + ": weapon #" + i + " ('" + wep.name + "') does not have a bullet defined. Make sure you have a bullet: (JSON) or `bullet = ` field in your unit definition.");
}
}
}
@CallSuper
@Override
public void init(){
@ -631,13 +641,6 @@ public class UnitType extends UnlockableContent{
}
}
for(int i = 0; i < weapons.size; i++){
var wep = weapons.get(i);
if(wep.bullet == Bullets.placeholder || wep.bullet == null){
throw new RuntimeException("Unit: " + name + ": weapon #" + i + " ('" + wep.name + "') does not have a bullet defined. Make sure you have a bullet: (JSON) or `bullet = ` field in your unit definition.");
}
}
if(pathCost == null){
pathCost =
example instanceof WaterMovec ? ControlPathfinder.costNaval :

View file

@ -1269,12 +1269,13 @@ public class Block extends UnlockableContent implements Senseable{
var gen = icons();
if(outlineIcon){
PixmapRegion region = Core.atlas.getPixmap(gen[outlinedIcon >= 0 ? Math.min(outlinedIcon, gen.length - 1) : gen.length -1]);
AtlasRegion atlasRegion = (AtlasRegion)gen[outlinedIcon >= 0 ? Math.min(outlinedIcon, gen.length - 1) : gen.length -1];
PixmapRegion region = Core.atlas.getPixmap(atlasRegion);
Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius);
if(Core.settings.getBool("linear", true)){
Pixmaps.bleed(out);
}
packer.add(PageType.main, name, out);
packer.add(PageType.main, atlasRegion.name, out);
}
var toOutline = new Seq<TextureRegion>();

View file

@ -37,7 +37,7 @@ public class DrawTurret extends DrawBlock{
part.getOutlines(out);
}
if(block.region.found() && !Core.atlas.has(block.name + "-preview")){
if(block.region.found()){
out.add(block.region);
}
}