Ludeon Forums

Ludeon Forums

  • August 13, 2022, 08:19:48 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Where are pawn body graphics defined?  (Read 1356 times)

Devon_v

  • Colonist
  • ***
  • Posts: 322
  • Refugee
    • View Profile
Where are pawn body graphics defined?
« 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?
Logged

Alistaire

  • Colonist
  • ***
  • Posts: 484
  • Mod Author
    • View Profile
Re: Where are pawn body graphics defined?
« Reply #1 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.

Code: [Select]
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.

Code: [Select]
path = apparel.def.apparel.wornGraphicPath + "_" + bodyType.ToString();
Logged

Devon_v

  • Colonist
  • ***
  • Posts: 322
  • Refugee
    • View Profile
Re: Where are pawn body graphics defined?
« Reply #2 on: June 18, 2015, 03:28:34 PM »

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

Alistaire

  • Colonist
  • ***
  • Posts: 484
  • Mod Author
    • View Profile
Re: Where are pawn body graphics defined?
« Reply #3 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
« Last Edit: June 18, 2015, 04:03:22 PM by Alistaire »
Logged

Devon_v

  • Colonist
  • ***
  • Posts: 322
  • Refugee
    • View Profile
Re: Where are pawn body graphics defined?
« Reply #4 on: June 24, 2015, 08:11:58 PM »

Thank you, that's very helpful. :)
Logged