Ludeon Forums

Ludeon Forums

  • June 19, 2021, 05:03:13 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Could I get a hand with Corpses, please?  (Read 244 times)

BrockLee

  • Muffalo
  • *
  • Posts: 3
  • Refugee
    • View Profile
Could I get a hand with Corpses, please?
« on: May 07, 2021, 01:57:29 AM »

Hi everyone, I've been a long-time lurker around the forums, and dabbled with modding Rimworld on and off for a while now. I've always tried to read through tutorials, search for answers on my own, and use the trial and error system. That being said, I've become a bit frustrated with my latest little project and I would appreciate some suggestions from you more experienced modders out there.

Essentially, I'm trying to break up, or rather, subdivide the AnimalCorpse category into three sub-categories; AnimalCorpseLg - AnimalCorpseMd - AnimalCorpseSm.

I've tried a couple of approaches without success. One using custom categories, and the other using tags.

Oh, and I have to stick with XML, as I'm not proficient with C+, so that might be the whole issue. I used DotPeek to poke through the files but still haven't come up with any new ideas.
Logged

m1st4x

  • Drifter
  • **
  • Posts: 72
  • Refugee
    • View Profile
Re: Could I get a hand with Corpses, please?
« Reply #1 on: May 07, 2021, 02:46:18 AM »

What exactly is your mod attempt to do?
Logged

Canute

  • Transcendent
  • *****
  • Posts: 9996
  • Refugee
    • View Profile
Re: Could I get a hand with Corpses, please?
« Reply #2 on: May 07, 2021, 02:47:15 AM »

Hi,
i am not a modder but longtime player and watcher.
XML is limited to existing thing, i mean you can't create anything new.
Corpse's auto. get created by rimworld and don't need a definition, similar to the leather.

But corpses allready got a weight.
Mods like the android printer from Androids need a mass (or was it nutrination since it accecpt meat too) of corpse.
The cremate corpse for compost from Vegetable garden need x kg corpses. So the pawn would gather many small corpses or one bigger.

Even you managed it to create your own categories, you need to patch each animal to assign it to that category. But any mod that would add animals would have default corpses.
Or you need to patch the rimworld routine how corpses get created and patch these (require c# not c+).

m1st4x

  • Drifter
  • **
  • Posts: 72
  • Refugee
    • View Profile
Re: Could I get a hand with Corpses, please?
« Reply #3 on: May 07, 2021, 03:05:46 AM »

Canute why did you never start modding?  ;)
Logged

Canute

  • Transcendent
  • *****
  • Posts: 9996
  • Refugee
    • View Profile
Re: Could I get a hand with Corpses, please?
« Reply #4 on: May 07, 2021, 04:24:43 AM »

Just too lazy, old people like to consum,relax and chat. :-)

BrockLee

  • Muffalo
  • *
  • Posts: 3
  • Refugee
    • View Profile
Re: Could I get a hand with Corpses, please?
« Reply #5 on: May 08, 2021, 02:59:11 AM »

@ m1st4x    Well, my first use for this mod is going to be in an upcoming tribal playthrough I'm planning. I want to impose some extra restrictions and challenges, including a different butchering system. For example, instead of butchering a muffalo and getting ready-to-use leather and meat, I want "rough hides" and a significantly reduced amount of meat (due to unskilled and primitive butchering methods), as well as some animal tallow and bones.

Adding the hides, tallow, and bones isn't an issue since those values are exposed in XML, but the vanilla meat quantity per animal is hardcoded (and I can't do C#), so I'm left with trying to find workarounds.

I'm aware there are a number of mods already out there that do bones, fat, and hides, but they bring a lot of other things with them I don't want. Plus, I like to a least try my own approach to things first so I can learn, even though it does get a bit frustrating at times.

@ Canute    Thanks for the suggestions, and pointing me toward those two mods. I've used both of them in my mod list before, so I looked into their files. x kg corpses would have been interesting, but unless I missed it, VGP garden only shows that it requires 1 corpse for the compost recipe. Perhaps it's been changed.  The android printer has some kind code for nutrition, from what I can tell.
And you're certainly correct, it's C#...I hit the wrong key.

However, I think I found an option that's somewhat workable. Earlier today I kept scanning through the core .cs file and I finally found something useful for my purposes; ThingDefGenerator_Corpses, where I saw this- def.defName = "Corpse_" + thingDef.defName;

So I threw together a test recipe and it seems to work good, though it needs some refinement.

Here's a copy of the recipe in case anyone else is curious:

Code: [Select]

<RecipeDef>
    <defName>Butcher_AnimalSm</defName>
    <label>butcher small animal</label>
    <description>Use primitive methods to roughly butcher a small animal for some meat and hide parts.</description>
    <workerCounterClass>RecipeWorkerCounter_ButcherAnimals</workerCounterClass>
    <jobString>Butchering.</jobString>
    <workAmount>350</workAmount>
    <workSpeedStat>ButcheryFleshSpeed</workSpeedStat>
    <workSkill>Cooking</workSkill>
    <efficiencyStat>ButcheryFleshEfficiency</efficiencyStat>
    <effectWorking>ButcherFlesh</effectWorking>
    <soundWorking>Recipe_ButcherCorpseFlesh</soundWorking>
    <interruptIfIngredientIsRotting>true</interruptIfIngredientIsRotting>
    <uiIconThing>Meat_Muffalo</uiIconThing>
    <ingredients>
      <li>
<filter>
      <thingDefs>
          <li>Corpse_Hare</li>
          <li>Corpse_Snowhare</li>
          <li>Corpse_Raccoon</li>
          <li>Corpse_Capybara</li>
          <li>Corpse_Fox_Red</li>
          <li>Corpse_Fox_Arctic</li>
          <li>Corpse_Cat</li>
      </thingDefs>
</filter>
        <count>1</count>
      </li>
    </ingredients>
    <products>
      <RoughHide>1</RoughHide>
  <Meat_Cow>12</Meat_Cow>  <!-- TEMPORARY Change this later -->
  <Tallow>2</Tallow>
  <Bone>2</Bone>
    </products>
    <fixedIngredientFilter>
      <thingDefs>
          <li>Corpse_Hare</li>
          <li>Corpse_Snowhare</li>
          <li>Corpse_Raccoon</li>
          <li>Corpse_Capybara</li>
          <li>Corpse_Fox_Red</li>
          <li>Corpse_Fox_Arctic</li>
          <li>Corpse_Cat</li>
      </thingDefs>
      <specialFiltersToDisallow>
        <li>AllowRotten</li>
      </specialFiltersToDisallow>
    </fixedIngredientFilter>
    <defaultIngredientFilter>
      <thingDefs>
          <li>Corpse_Hare</li>
          <li>Corpse_Snowhare</li>
          <li>Corpse_Raccoon</li>
          <li>Corpse_Capybara</li>
          <li>Corpse_Fox_Red</li>
          <li>Corpse_Fox_Arctic</li>
          <li>Corpse_Cat</li>
      </thingDefs>
    </defaultIngredientFilter>
    <workSkill>Cooking</workSkill>
    <recipeUsers>
      <li>BM_PrimButcherTable</li>
    </recipeUsers>
  </RecipeDef>
 
Logged