Mod corpses as a thing

Started by projecttemp, June 23, 2015, 07:14:57 PM

Previous topic - Next topic

projecttemp

Hi, i recently started modding and there is one things that i don't know how to do.

-How to mod the corpse of all the units? This seems to be auto generated, but i want to give them a deterioration rate like other items, so after 100 days they get destroy instead of hanging around as bones.

Illusion Distort

Have a look at
"rimworld_location"\RimWorld"version"Win\Source\Verse\ThingComps\CompLifespan.cs
"rimworld_location"\RimWorld"version"Win\Source\Verse\Thing\Corpse.cs

You can use some of the code and/or override it to make corpses "vanish" after a certian amount of time.

If you need further help let me know. :D

projecttemp

#2
Thats awesome, thank you.

After looking at it, i noticed how it does disappear after 100 days, but only for animal corpses. Is there a way to directly override only the "ShouldVanish" method on startup?

Also, is there an XML of this Corpse class?

Illusion Distort

Forgot to mention:
"rimworld_location"\RimWorld"version"Win\Source\Rimworld\ThingComps\ThingComps\CompRottable

You can copy the corpse code, make a new .cs file, override the original corpse class, compile it as a dll and go through a couple of hour of trail and error.
It would look something like this:

Namespace "Namespace"
{
class "classname"
{
public override Corpse : ThingWithComps, IThoughtGiver, IStrippable, IBillGiver //this seems wrong
{
private bool ShouldVanish
    {
        get
        {
             return innerPawn.RaceProps.Humanoid &&
                    vanishAfterTimestamp > 0 &&
                    Age >= vanishAfterTimestamp &&
                    this.GetRoom().TouchesMapEdge &&
                    !Find.RoofGrid.Roofed(Position);
        }
}
}
}
    }


This is not a "proper" way to do this, but i have spent waaaaaay too much time on formulating my answer...

QuoteAlso, is there an XML of this Corpse class?

Not that i know of, the corpse seem to be created based on a pawns stats(apparel, skills, race, hairdif, etc), if you are not interested in doing a dll mod you could just burn/cremate the corpses and focus on other improvments you can make to the game, possibly involving a new way to get rid of all them corpses. *Hint*

As always: If you need, more help/spittball suggestions/ideas. Make a new thread, pm me or respond to this post. :D

projecttemp

Wow, thank you very much. This was a very helpful learning experience.