Ludeon Forums

RimWorld => Mods => Help => Topic started by: Devon_v on June 17, 2015, 09:08:37 PM

Title: Where are pawn body graphics defined?
Post by: Devon_v on June 17, 2015, 09:08:37 PM
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?
Title: Re: Where are pawn body graphics defined?
Post by: Alistaire on June 18, 2015, 04:01:11 AM
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();
Title: Re: Where are pawn body graphics defined?
Post by: Devon_v on June 18, 2015, 03:28:34 PM
Thank you for the code snippets. Is that in one of the included source files?
Title: Re: Where are pawn body graphics defined?
Post by: Alistaire on June 18, 2015, 03:39:28 PM
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 (http://rimworldwiki.com/wiki/Modding_Tutorials/Decompiling_source_code)
Title: Re: Where are pawn body graphics defined?
Post by: Devon_v on June 24, 2015, 08:11:58 PM
Thank you, that's very helpful. :)