mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-06 07:30:35 +07:00
Misc fixes for mods (2)
This commit is contained in:
parent
b66283fbd0
commit
e9290af4d2
@ -100,9 +100,7 @@ public abstract class UnlockableContent extends MappableContent{
|
||||
if(!makeNew || !packer.has(name + "-outline")){
|
||||
PixmapRegion base = Core.atlas.getPixmap(region);
|
||||
var result = Pixmaps.outline(base, outlineColor, outlineRadius);
|
||||
if(Core.settings.getBool("linear", true)){
|
||||
Pixmaps.bleed(result);
|
||||
}
|
||||
Drawf.checkBleed(result);
|
||||
packer.add(page, name + (makeNew ? "-outline" : ""), result);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mindustry.graphics;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
@ -18,6 +19,11 @@ public class Drawf{
|
||||
private static final Vec2[] vecs = new Vec2[]{new Vec2(), new Vec2(), new Vec2(), new Vec2()};
|
||||
private static final FloatSeq points = new FloatSeq();
|
||||
|
||||
/** Bleeds a mod pixmap if linear filtering is enabled. */
|
||||
public static void checkBleed(Pixmap pixmap){
|
||||
if(Core.settings.getBool("linear", true)) Pixmaps.bleed(pixmap);
|
||||
}
|
||||
|
||||
//TODO offset unused
|
||||
public static void flame(float x, float y, int divisions, float rotation, float length, float width, float pan){
|
||||
float len1 = length * pan, len2 = length * (1f - pan);
|
||||
|
@ -188,12 +188,15 @@ public class Mods implements Loadable{
|
||||
if(!prefix && !Core.atlas.has(name)){
|
||||
Log.warn("Sprite '@' in mod '@' attempts to override a non-existent sprite. Ignoring.", name, mod.name);
|
||||
continue;
|
||||
}
|
||||
|
||||
//TODO !!! document this on the wiki !!!
|
||||
//do not allow packing standard outline sprites for now, they are no longer necessary and waste space!
|
||||
//TODO also full regions are bad: || name.endsWith("-full")
|
||||
if(prefix && (name.endsWith("-outline"))) continue;
|
||||
//(horrible code below)
|
||||
}else if(prefix && name.endsWith("-outline") && file.path().contains("units") && !file.path().contains("blocks")){
|
||||
Log.warn("Sprite '@' in mod '@' is likely to be an unnecessary unit outline. These should not be separate sprites. Ignoring.", name, mod.name);
|
||||
//TODO !!! document this on the wiki !!!
|
||||
//do not allow packing standard outline sprites for now, they are no longer necessary and waste space!
|
||||
//TODO also full regions are bad: || name.endsWith("-full")
|
||||
continue;
|
||||
}
|
||||
|
||||
//read and bleed pixmaps in parallel
|
||||
tasks.add(mainExecutor.submit(() -> {
|
||||
|
@ -860,7 +860,7 @@ public class UnitType extends UnlockableContent{
|
||||
String regionName = atlas.name;
|
||||
Pixmap outlined = Pixmaps.outline(Core.atlas.getPixmap(region), outlineColor, outlineRadius);
|
||||
|
||||
if(Core.settings.getBool("linear", true)) Pixmaps.bleed(outlined);
|
||||
Drawf.checkBleed(outlined);
|
||||
|
||||
packer.add(PageType.main, regionName + "-outline", outlined);
|
||||
}
|
||||
|
@ -1250,9 +1250,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
}
|
||||
}
|
||||
|
||||
if(Core.settings.getBool("linear", true)){
|
||||
Pixmaps.bleed(out);
|
||||
}
|
||||
Drawf.checkBleed(out);
|
||||
|
||||
packer.add(PageType.main, name + "-team-" + team.name, out);
|
||||
}
|
||||
@ -1272,9 +1270,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
AtlasRegion atlasRegion = (AtlasRegion)gen[outlinedIcon >= 0 ? Math.min(outlinedIcon, gen.length - 1) : gen.length -1];
|
||||
PixmapRegion region = Core.atlas.getPixmap(atlasRegion);
|
||||
Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius);
|
||||
if(Core.settings.getBool("linear", true)){
|
||||
Pixmaps.bleed(out);
|
||||
}
|
||||
Drawf.checkBleed(out);
|
||||
packer.add(PageType.main, atlasRegion.name, out);
|
||||
}
|
||||
|
||||
@ -1286,7 +1282,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
String regionName = atlas.name;
|
||||
Pixmap outlined = Pixmaps.outline(Core.atlas.getPixmap(region), outlineColor, outlineRadius);
|
||||
|
||||
if(Core.settings.getBool("linear", true)) Pixmaps.bleed(outlined);
|
||||
Drawf.checkBleed(outlined);
|
||||
|
||||
packer.add(PageType.main, regionName + "-outline", outlined);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user