standardBodyGraphicPath and humanoid pawns

Started by mispy, June 07, 2014, 11:56:50 AM

Previous topic - Next topic

mispy

Just a heads up for anyone else trying to mod in new kinds of colonists: standardBodyGraphicPath currently doesn't apply to humanoid races. (and if you try to make a non-humanoid colonist it'll throw an error) Here's the relevant part of the game code:



It is still feasible, but you'll need to do some C# trickery to get around the hardcoded stuff. Proof of concept: https://github.com/mispy/DwarfColonists/blob/master/Source/DwarfColonists/DwarfPawn.cs#L17

Hopefully Tynan will make the defs more flexible at some stage. (I wish this were OSS so I could do it myself, it's kinda frustrating looking at all the lovely decompiled CIL I can't alter :D)

Justin C

Another thing you might want to note while working with Humanoid textures is that the game can be really picky about skinColor. If you want to have strangely colored Humanoid pawns, you cannot just set the Pawn's skin color when you generate it as you might expect. The game generates head graphics ahead of time using a hardcoded list of skin tones, so if you set the skin color to a color the game didn't render a head for before it calls ResolveGraphics, the game will call that GetHeadNamed function using your custom color and then throw an error because it wasn't expecting your custom skin tone.

So to get around this you will have to make sure you resolve the graphics first, and then you can manually generate a new Graphic_Head and assign it to your pawn:
Graphic_Head zombieHead = new Graphic_Head(pawn.drawer.renderer.graphics.headGraphic.graphicPath, ZombieMod_Utility.zombieSkinColor);
pawn.drawer.renderer.graphics.headGraphic = zombieHead;


The bodies will work fine with whatever skinColor you give them, it's just the heads that will give you trouble.