Better mod unit packing

This commit is contained in:
Anuken
2022-04-19 16:51:43 -04:00
parent 56c02faedc
commit 81acc5285c
3 changed files with 15 additions and 4 deletions

View File

@@ -186,7 +186,8 @@ public class Mods implements Loadable{
//TODO !!! document this on the wiki !!! //TODO !!! document this on the wiki !!!
//do not allow packing standard outline sprites for now, they are no longer necessary and waste space! //do not allow packing standard outline sprites for now, they are no longer necessary and waste space!
if(prefix && name.endsWith("-outline")) continue; //TODO also full regions are bad: || name.endsWith("-full")
if(prefix && (name.endsWith("-outline"))) continue;
//read and bleed pixmaps in parallel //read and bleed pixmaps in parallel
tasks.add(mainExecutor.submit(() -> { tasks.add(mainExecutor.submit(() -> {
@@ -314,6 +315,7 @@ public class Mods implements Loadable{
//generate new icons //generate new icons
for(Seq<Content> arr : content.getContentMap()){ for(Seq<Content> arr : content.getContentMap()){
arr.each(c -> { arr.each(c -> {
//TODO this can be done in parallel
if(c instanceof UnlockableContent u && c.minfo.mod != null){ if(c instanceof UnlockableContent u && c.minfo.mod != null){
u.load(); u.load();
u.loadIcon(); u.loadIcon();

View File

@@ -655,14 +655,18 @@ public class UnitType extends UnlockableContent{
} }
} }
//currently does not create outlines for legs or base regions due to older mods having them outlined by default
if(outlines){ if(outlines){
//outlines only created when forced at the moment //note that mods with these regions already outlined will have *two* outlines made, which is... undesirable
makeOutline(PageType.main, packer, region, alwaysCreateOutline, outlineColor, outlineRadius); for(var outlineTarget : new TextureRegion[]{region, jointRegion, footRegion, legBaseRegion, baseJointRegion, legRegion, treadRegion}){
if(!outlineTarget.found()) continue;
makeOutline(PageType.main, packer, outlineTarget, alwaysCreateOutline && region == outlineTarget, outlineColor, outlineRadius);
}
for(Weapon weapon : weapons){ for(Weapon weapon : weapons){
if(!weapon.name.isEmpty()){ if(!weapon.name.isEmpty()){
//TODO makeNew isn't really necessary here is it
makeOutline(PageType.main, packer, weapon.region, true, outlineColor, outlineRadius); makeOutline(PageType.main, packer, weapon.region, true, outlineColor, outlineRadius);
} }
} }

View File

@@ -451,4 +451,9 @@ public class Weapon implements Cloneable{
} }
} }
@Override
public String toString(){
return name == null || name.isEmpty() ? "Weapon" : "Weapon: " + name;
}
} }