Where are pawn body graphics defined?

Started by Devon_v, June 17, 2015, 09:08:37 PM

Previous topic - Next topic

Devon_v

I've been fiddling with the core game files and the art source dump, and I see where the five human body types are referred to in Backstories, but I cannot see anywhere where they are actually defined or linked to the graphics.

Are they hardcoded as is, or does the engine just take "Hulk" and automatically search for "*_Hulk_Front.*" etc?

Alistaire

BodyType is a list with body types as keys and numbers as values in the game's code. Whenever a body has to be drawn it does indeed "automatically search" the body type in some way, but the body type's locations are hardcoded so there's little searching to do.

private const string NakedBodyTextureFolderPath = "Things/Pawn/Humanlike/Bodies/";
public static Graphic GetNakedBodyGraphic(BodyType bodyType, Shader shader, Color skinColor)
{
if (bodyType == BodyType.Undefined)
{
Log.Error("Getting naked body graphic with undefined body type.");
bodyType = BodyType.Male;
}
string str = "Naked_" + bodyType.ToString();
string path = "Things/Pawn/Humanlike/Bodies/" + str;
return GraphicDatabase.Get<Graphic_Multi>(path, shader, Vector2.one, skinColor);
}


When deciding which type of clothing to use, the game just adds "_" + body type to a clothing's graphic path.

path = apparel.def.apparel.wornGraphicPath + "_" + bodyType.ToString();

Devon_v

Thank you for the code snippets. Is that in one of the included source files?

Alistaire

#3
Probably not, but they were taken from the decompiled Assembly-CSharp.dll file. I ought to write a tutorial on the wiki on ILSpy so people can look at the decompiled source code themselves.

EDIT: There you go

Devon_v