Merging changes from private branch

This commit is contained in:
Anuken 2025-04-04 11:47:35 -04:00
parent cf5c6d0905
commit b7dbe54d76
161 changed files with 2484 additions and 1137 deletions

View file

@ -11,6 +11,7 @@ import arc.struct.*;
import arc.util.*;
import arc.util.noise.*;
import mindustry.ctype.*;
import mindustry.entities.part.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@ -508,7 +509,7 @@ public class Generators{
});
generate("unit-icons", () -> content.units().each(type -> {
if(type.internal) return; //internal hidden units don't generate
if(type.internal && !type.internalGenerateSprites) return; //internal hidden units don't generate
ObjectSet<String> outlined = new ObjectSet<>();
@ -530,6 +531,28 @@ public class Generators{
save(pix, ((GenRegion)region).name + "-outline");
}
Seq<DrawPart> allParts = new Seq<>();
//this code is complete trash
Cons<Seq<DrawPart>>[] allDrawIter = new Cons[]{null};
allDrawIter[0] = seq -> {
for(DrawPart part : seq){
allParts.add(part);
if(part instanceof RegionPart){
allDrawIter[0].get(((RegionPart)part).children);
}
}
};
allDrawIter[0].get(type.parts);
for(DrawPart part : allParts){
if(part instanceof RegionPart && ((RegionPart)part).replaceOutline){
for(TextureRegion r : ((RegionPart)part).regions){
outliner.get(r);
}
}
}
Seq<Weapon> weapons = type.weapons;
weapons.each(Weapon::load);
weapons.removeAll(w -> !w.region.found());
@ -580,7 +603,8 @@ public class Generators{
if(sample instanceof Legsc) outliner.get(type.legRegion);
if(sample instanceof Tankc) outliner.get(type.treadRegion);
Pixmap image = type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.previewRegion));
//TODO: for drawBody false, an empty pixmap is used; this is a hack
Pixmap image = type.segments > 0 ? get(type.segmentRegions[0]) : type.drawBody ? outline.get(get(type.previewRegion)) : new Pixmap(1, 1);
Func<Weapon, Pixmap> weaponRegion = weapon -> Core.atlas.has(weapon.name + "-preview") ? get(weapon.name + "-preview") : get(weapon.region);
Cons2<Weapon, Pixmap> drawWeapon = (weapon, pixmap) ->
@ -608,7 +632,7 @@ public class Generators{
//outline is currently never needed, although it could theoretically be necessary
if(type.needsBodyOutline()){
save(image, type.name + "-outline");
}else if(type.segments == 0){
}else if(type.segments == 0 && type.drawBody){
replace(type.name, type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.region)));
}
@ -676,7 +700,9 @@ public class Generators{
}
//TODO I can save a LOT of space by not creating a full icon.
save(image, "unit-" + type.name + "-full");
if(type.generateFullIcon){
save(image, "unit-" + type.name + "-full");
}
Rand rand = new Rand();
rand.setSeed(type.name.hashCode());

View file

@ -16,6 +16,7 @@ import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.world.blocks.*;
import java.io.*;
@ -109,7 +110,7 @@ public class ImagePacker{
map.each((key, val) -> content2id.put(val.split("\\|")[0], key));
Seq<UnlockableContent> cont = Seq.withArrays(Vars.content.blocks(), Vars.content.items(), Vars.content.liquids(), Vars.content.units(), Vars.content.statusEffects());
cont.removeAll(u -> u instanceof ConstructBlock || u == Blocks.air);
cont.removeAll(u -> u instanceof ConstructBlock || u == Blocks.air || (u instanceof UnitType t && t.internal));
int minid = 0xF8FF;
for(String key : map.keys()){