Fixed sprites in wrong atlas

This commit is contained in:
Anuken
2025-07-18 18:53:58 -04:00
parent 2e41e58b59
commit c32f7473e8
13 changed files with 18 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ public class Generators{
//theoretically this might not finish in time, but I doubt that will ever happen
mainExecutor.submit(() -> {
try{
ImageTileGenerator.generate(basePath, block.name + (variants <= 1 ? "" : "-" + (variant+1)), new Fi("../../../assets-raw/sprites_out/blocks/environment/" + (block.name + (variants <= 1 ? "" : "-" + (variant+1)))));
ImageTileGenerator.generate(basePath, block.name + (variants <= 1 ? "" : "-" + (variant+1)), new Fi("../../../assets-raw/sprites_out/blocks/environment"));
}catch(Throwable e){
Log.err("Failed to autotile: " + block.name, e);
}finally{
@@ -514,7 +514,7 @@ public class Generators{
Pixmap container = new Pixmap(base.width + 10, base.height + 10);
container.draw(base, 5, 5, true);
replace("sector-" + item.name, container.outline(Pal.darkerGray, 5));
replace("../ui/sector-" + item.name, "sector-" + item.name, container.outline(Pal.darkerGray, 5));
}
});

View File

@@ -29,6 +29,8 @@ public class ImagePacker{
//makes PNG loading slightly faster
ArcNativesLoader.load();
fixSubdirectory("blocks/environment/character-overlay");
Core.settings = new MockSettings();
Log.logger = new NoopLogHandler();
Vars.content = new ContentLoader();
@@ -200,6 +202,15 @@ public class ImagePacker{
}
}
static void fixSubdirectory(String dir){
Fi folder = Fi.get("../../../assets-raw/sprites_out/" + dir);
Fi parent = folder.parent();
folder.walk(fi -> {
fi.moveTo(parent.child(fi.name()));
});
folder.delete();
}
static String texname(UnlockableContent c){
return c.getContentType() + "-" + c.name + "-ui";
}
@@ -251,7 +262,11 @@ public class ImagePacker{
}
static void replace(String name, Pixmap image){
Fi.get(name + ".png").writePng(image);
replace(name, name, image);
}
static void replace(String path, String name, Pixmap image){
Fi.get(path + ".png").writePng(image);
((GenRegion)Core.atlas.find(name)).path.delete();
}