Fixed treads on modded units

This commit is contained in:
Anuken
2022-09-20 15:27:11 -04:00
parent 3eb6061358
commit 7aaf5e477b
3 changed files with 10 additions and 7 deletions

View File

@@ -107,6 +107,7 @@ public class Planets{
accessible = false; accessible = false;
visible = false; visible = false;
atmosphereColor = Color.valueOf("3db899"); atmosphereColor = Color.valueOf("3db899");
iconColor = Color.valueOf("597be3");
startSector = 10; startSector = 10;
atmosphereRadIn = -0.01f; atmosphereRadIn = -0.01f;
atmosphereRadOut = 0.3f; atmosphereRadOut = 0.3f;
@@ -116,7 +117,6 @@ public class Planets{
}; };
}}; }};
//TODO hide beryllium and others on load in rules
serpulo = new Planet("serpulo", sun, 1f, 3){{ serpulo = new Planet("serpulo", sun, 1f, 3){{
generator = new SerpuloPlanetGenerator(); generator = new SerpuloPlanetGenerator();
meshLoader = () -> new HexMesh(this, 6); meshLoader = () -> new HexMesh(this, 6);
@@ -157,10 +157,6 @@ public class Planets{
gen.carbonChance = 0.1f; gen.carbonChance = 0.1f;
gen.ferricChance = 0f; gen.ferricChance = 0f;
}); });
//define launch candidates after all planets initialize
//TODO how will it use the nucleus???
serpulo.launchCandidates.add(erekir);
} }
private static Planet makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){ private static Planet makeAsteroid(String name, Planet parent, Block base, Block tint, float tintThresh, int pieces, float scale, Cons<AsteroidGenerator> cgen){
@@ -174,11 +170,12 @@ public class Planets{
accessible = false; accessible = false;
clipRadius = 2f; clipRadius = 2f;
defaultEnv = Env.space; defaultEnv = Env.space;
icon = "commandRally";
generator = new AsteroidGenerator(); generator = new AsteroidGenerator();
cgen.get((AsteroidGenerator)generator); cgen.get((AsteroidGenerator)generator);
meshLoader = () -> { meshLoader = () -> {
iconColor = tint.mapColor;
Color tinted = tint.mapColor.cpy().a(1f - tint.mapColor.a); Color tinted = tint.mapColor.cpy().a(1f - tint.mapColor.a);
Seq<GenericMesh> meshes = new Seq<>(); Seq<GenericMesh> meshes = new Seq<>();
Color color = base.mapColor; Color color = base.mapColor;

View File

@@ -380,6 +380,11 @@ public class ContentParser{
} }
} }
//try to parse Rect as array
if(type == Rect.class && jsonData.isArray() && jsonData.size == 4){
return (T)new Rect(jsonData.get(0).asFloat(), jsonData.get(1).asFloat(), jsonData.get(2).asFloat(), jsonData.get(3).asFloat());
}
if(Content.class.isAssignableFrom(type)){ if(Content.class.isAssignableFrom(type)){
ContentType ctype = contentTypes.getThrow(type, () -> new IllegalArgumentException("No content type for class: " + type.getSimpleName())); ContentType ctype = contentTypes.getThrow(type, () -> new IllegalArgumentException("No content type for class: " + type.getSimpleName()));
String prefix = currentMod != null ? currentMod.name + "-" : ""; String prefix = currentMod != null ? currentMod.name + "-" : "";

View File

@@ -907,6 +907,8 @@ public class UnitType extends UnlockableContent{
public void createIcons(MultiPacker packer){ public void createIcons(MultiPacker packer){
super.createIcons(packer); super.createIcons(packer);
sample = constructor.get();
var toOutline = new Seq<TextureRegion>(); var toOutline = new Seq<TextureRegion>();
getRegionsToOutline(toOutline); getRegionsToOutline(toOutline);
@@ -947,7 +949,6 @@ public class UnitType extends UnlockableContent{
} }
} }
//TODO test
if(sample instanceof Tankc){ if(sample instanceof Tankc){
PixmapRegion pix = Core.atlas.getPixmap(treadRegion); PixmapRegion pix = Core.atlas.getPixmap(treadRegion);