I've been making a personal little mod to change ship paintjobs through a hullmod and i've run up against a few problems (one small and one big, though both are kinda minor)
First off the small one - can we get something like isShowDamageWhenDecorative() for weaponSpecAPI, it'd be a nice shorthand for seeing if something is a deco that actually needs to be replaced (and is kinda wierd that isRenderAboveAllWeapons() is a thing but this isn't, I guess no one's asked for it beore?)
And the big one - clearing decorative slots and replacing the weapon in them seems to completely break / ignore render order.
deco weapon replacement code
for (WeaponAPI weapon : ship.getAllWeapons()) {
String weapslot = weapon.getSlot().getId();
String weapid = weapon.getId();
ShipVariantAPI variant = ship.getMutableStats().getVariant();
boolean hasSwapped = weapid.contains(prefix); //prefix for weapon graphics & names
boolean isBlinker = weapid.contains("blinker"); //checks for "not armour deco" stuff start
boolean isGlow = weapid.contains("glow") || weapid.contains("light");
boolean isEmpCore = weapid.contains("empcore");
boolean isShadow = weapid.contains("shadow");//checks end
if (weapon.getSlot().isDecorative() && !hasSwapped && !isBlinker && !isEmpCore && !isGlow && !isShadow) {
variant.clearSlot(weapslot);
variant.addWeapon(weapslot, prefix + weapid);
}
}
This swaps all non-painted deco weaps that have replacements to their painted equivalents, but somewhere along the way it also seems to completely break the render order of the replaced weaps, despite not touching it at all.
It's also got the wierd side effect of keeping the broken render order between removing the hullmod and fully stripping the ship, though I'm assuming that's because I never readd the unpainted decos (?)
no hullmod, shadow & covers are over guns
with paintjob, shadows are over gun but covers are below
after removing paintjob, before stripping the ship, same as image 2
Safarijohn suggested saving the variant then stripping it & putting it all back in code, but that seems too complicated for me (and this
feels like a bug so I thought I'd ask here as well)
, honestly I'm hoping I just overlooked something obvious