Surgery mod need help

Started by Simulacrum0, October 24, 2016, 03:34:47 PM

Previous topic - Next topic

Simulacrum0

i have been trying to add surgery's to deal with mechanites (gut worms and muscle parasites to if i can get this working) the problem is "Whole body" is not a bodypart so normal surgery recipes don't work. so i ether need a way to make a surgery recipe target whole body or make the Incidents_Disease target a body part and i don't know how to code C#.

Silerra

Why do you want to program in C++? The game is written in C# (C-Sharp) and this is not the same programming language as C++.
Read this thread to have a base to implement your own C# extension: https://ludeon.com/forums/index.php?topic=3408.0

And here the link to C#-Reference: https://msdn.microsoft.com/en-us/library/618ayhy6.aspx

Well, C# is easier to learn than C++. ;-)

kaptain_kavern

Most of medical mods I've seen (the ones done in XML atleast) are shortcutting the problem by modding the illness in itself to be tied to a bodyparts, if it can be of any help.

Else, don't hesitate to elaborate I will try to help (if I can - a.k.a. : no C# for me ^^ )

Simulacrum0

Silerra: i meant C#

kaptain_kavern: what mod have you seen that makes diseases created from incidents target body parts?


Dingo

I don't see the problem. You just make a surgery recipe with <removesHediff>HediffDefName</removesHediff> as part of the RecipeDef. You don't need to target a body part with the recipe.

kaptain_kavern

#5
Oh then it is even better than before ^^ What I said for previous version then

I will have to revise DESurgeries then ;-)

Quote from: Simulacrum0 on October 24, 2016, 06:01:54 PM
kaptain_kavern: what mod have you seen that makes diseases created from incidents target body parts?

EPOE, DESurgeries and older ones that aren't up to date now

Edit : Here for DESurgeries and muscles parasites for example

Simulacrum0

kaptain_kavern: that is just what i need thank you.

Dingo: the recipe its self does not show up if the disease/infection is not on a body part.


Dingo

Can you share the recipe def XML?

Simulacrum0

#8
<RecipeDef ParentName="SurgeryMechanites">
      <defName>PurgeSensoryMechanites</defName>
      <label>Purge Mechanites</label>
      <description>Purge Mechanites.</description>
      <workerClass>Recipe_RemoveHediff</workerClass>
      <jobString>Purging Mechanites.</jobString>
      <workAmount>4500</workAmount>
      <removesHediff>SensoryMechanites</removesHediff>
      <successfullyRemovedHediffMessage>{0} has successfully Purged {1}'s Mechanites.</successfullyRemovedHediffMessage>
      <surgeonSurgerySuccessChanceExponent>0</surgeonSurgerySuccessChanceExponent>
      <ingredients>
         <li>
            <filter>
               <categories>
                  <li>Medicine</li>
               </categories>
            </filter>
            <count>3</count>
         </li>
         <li>
            <filter>
               <thingDefs>
                  <li>Weapon_GrenadeEMP</li>
               </thingDefs>
            </filter>
            <count>1</count>
         </li>
      </ingredients>
      <fixedIngredientFilter>
         <categories>
            <li>Medicine</li>
         </categories>
         <thingDefs>
            <li>Weapon_GrenadeEMP</li>
         </thingDefs>
      </fixedIngredientFilter>
      <skillRequirements>
         <li>
            <skill>Medicine</skill>
            <minLevel>5</minLevel>
         </li>
         <li>
            <skill>Research</skill>
            <minLevel>5</minLevel>
         </li>
      </skillRequirements>
  </RecipeDef>

it works if the mechanites are on a body part. the whole body effect is no part that's why you cant heal a paw with it using dev console.

Dingo

I think Recipe_RemoveHediff can't target without a body part. I had a brief look at the code, it would need a new WorkerClass but it's possible.

kaptain_kavern

Hence the "hack" I found while keeping over the maintenance of DESurgeries (The modded disease I talked about above). At first I wasn't understanding where does it came and why. Until I noticed EPOE and other medical mods had similar ones

Simulacrum0

i don't know how to code c# and wanted a way to deal with this s#$^, up to 8 months of 1/3 of my colonists going berserk and binges gets old.