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

@@ -1104,7 +1104,7 @@ public class TypeIO{
} }
} }
/** Represents a unit that has not been resolved yet. TODO unimplemented / unused*/ /** Represents a unit that has not been resolved yet. */
public static class UnitBox implements Boxed<Unit>{ public static class UnitBox implements Boxed<Unit>{
public int id; public int id;

View File

@@ -60,6 +60,7 @@ public class ConsumePayloadDynamic extends Consume{
var inv = build.getPayloads(); var inv = build.getPayloads();
var pay = payloads.get(build); var pay = payloads.get(build);
table.clear();
table.table(c -> { table.table(c -> {
int i = 0; int i = 0;
for(var stack : pay){ for(var stack : pay){

View File

@@ -69,6 +69,28 @@ public class Generators{
public static void run(){ public static void run(){
ObjectMap<Block, Pixmap> gens = new ObjectMap<>(); 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", () -> { generate("splashes", () -> {
int frames = 12; int frames = 12;

File diff suppressed because one or more lines are too long