Generate autotiles at gradle pack time

This commit is contained in:
Anuken
2025-06-10 20:21:20 -04:00
parent 70ad6eb7d1
commit e5c745ee16
5 changed files with 92 additions and 1 deletions

View File

@@ -69,6 +69,28 @@ public class Generators{
public static void run(){
ObjectMap<Block, Pixmap> gens = new ObjectMap<>();
generate("autotiles", () -> {
for(Floor floor : content.blocks().select(b -> b.isFloor() && b.asFloor().autotile).<Floor>as()){
Fi basePath = new Fi("../../../assets-raw/sprites_out/blocks/environment/" + floor.name + "-autotile.png");
if(basePath.exists()){
//theoretically this might not finish in time, but I doubt that will ever happen
mainExecutor.submit(() -> {
try{
ImageTileGenerator.generate(basePath, floor.name, new Fi("../../../assets-raw/sprites_out/blocks/environment/" + floor.name));
}catch(Exception e){
Log.err("Failed to autotile: " + floor.name, e);
}finally{
//the raw autotile source image must never be included, it isn't useful
basePath.delete();
}
});
}else{
Log.warn("Autotile floor '@' not found: @", floor.name, basePath.absolutePath());
}
}
});
generate("splashes", () -> {
int frames = 12;

File diff suppressed because one or more lines are too long