Generate autotiles at gradle pack time
This commit is contained in:
Binary file not shown.
@@ -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 int id;
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public class ConsumePayloadDynamic extends Consume{
|
||||
var inv = build.getPayloads();
|
||||
var pay = payloads.get(build);
|
||||
|
||||
table.clear();
|
||||
table.table(c -> {
|
||||
int i = 0;
|
||||
for(var stack : pay){
|
||||
|
||||
@@ -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;
|
||||
|
||||
68
tools/src/mindustry/tools/ImageTileGenerator.java
Normal file
68
tools/src/mindustry/tools/ImageTileGenerator.java
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user