T4/5 naval / Controversial weapon outlines
This commit is contained in:
@@ -306,10 +306,22 @@ public class Generators{
|
||||
ImagePacker.generate("unit-icons", () -> content.units().each(type -> {
|
||||
if(type.isHidden()) return; //hidden units don't generate
|
||||
|
||||
ObjectSet<String> outlined = new ObjectSet<>();
|
||||
|
||||
try{
|
||||
type.load();
|
||||
type.init();
|
||||
|
||||
//TODO decide whether to keep weapon outlines or not
|
||||
if(true)
|
||||
for(Weapon weapon : type.weapons){
|
||||
if(weapon.rotate && outlined.add(weapon.name) && ImagePacker.has(weapon.name)){
|
||||
ImagePacker.get(weapon.name).outline(4, Pal.darkerMetal).save(weapon.name);
|
||||
|
||||
((GenRegion)Core.atlas.find(weapon.name)).path.delete();
|
||||
}
|
||||
}
|
||||
|
||||
Image image = ImagePacker.get(type.parts > 0 ? type.partRegions[0] : type.region);
|
||||
for(int i = 1; i < type.parts; i++){
|
||||
image.draw(ImagePacker.get(type.partRegions[i]));
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.tools;
|
||||
import arc.func.*;
|
||||
import arc.graphics.Color;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.tools.ImagePacker.*;
|
||||
@@ -60,6 +61,33 @@ class Image{
|
||||
return color;
|
||||
}
|
||||
|
||||
Image outline(int radius, Color outlineColor){
|
||||
Image out = copy();
|
||||
for(int x = 0; x < out.width; x++){
|
||||
for(int y = 0; y < out.height; y++){
|
||||
|
||||
Color color = getColor(x, y);
|
||||
out.draw(x, y, color);
|
||||
if(color.a < 1f){
|
||||
boolean found = false;
|
||||
outer:
|
||||
for(int rx = -radius; rx <= radius; rx++){
|
||||
for(int ry = -radius; ry <= radius; ry++){
|
||||
if(Mathf.dst(rx, ry) <= radius && getColor(rx + x, ry + y).a > 0.01f){
|
||||
found = true;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found){
|
||||
out.draw(x, y, outlineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
void each(Intc2 cons){
|
||||
for(int x = 0; x < width; x++){
|
||||
for(int y = 0; y < height; y++){
|
||||
|
||||
Reference in New Issue
Block a user