Ludeon Forums

Ludeon Forums

  • May 27, 2020, 05:31:09 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 7

Author Topic: [A18] Improved Surgery  (Read 48325 times)

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
[A18] Improved Surgery
« on: August 24, 2016, 11:31:27 PM »

Note: This mod uses HugsLib. If you do not have that mod installed you will get errors. Grab it: https://ludeon.com/forums/index.php?topic=28066.0

This mod tweaks surgery to be a bit more forgiving.
   
- Failures no longer instantly destroy prosthetics/bionics/implants being installed. The item that was being installed will be returned, but with less health. This means that if you are installing an item that is worn out or damaged, failing too many times will destroy it.

- Extreme failures which cause random body part damage are much less likely to occur. In these cases, it will more likely be a major failure that causes an infection instead.


Other surgery mods may possibly conflict with this one.

Get it now: http://steamcommunity.com/sharedfiles/filedetails/?id=751352140

Non-steam link (and source code): https://bitbucket.org/twoski/rimworldmods/downloads

Licensing:

You may include this mod in a modpack, however do keep in mind that i may update it. It is better if you add this to a steam-based modpack since steam automatically updates when i submit my changes.

You may derive from this mod but please add a visible link to this mod if you do.
« Last Edit: December 13, 2017, 06:27:13 PM by twoski »
Logged

123nick

  • Colonist
  • ***
  • Posts: 391
  • Refugee
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #1 on: August 25, 2016, 12:08:16 AM »

This mod makes surgery slightly less random.

- Failures no longer automatically destroy prosthetics/bionics/implants being installed. The item that was being installed will be returned, but with less health. This means that if you are installing an item that is worn out or damaged, failing too many times will destroy it.

- Failures no longer damage or remove random body parts, and will prioritize adding surgical cuts on body parts that are near the part being operated on.

- Minor failures now have a small chance to cause an infection on the body part being operated on. Major failures have a higher chance.



I had to do some fancy footwork to make this mod function - chances are it will conflict with any other mod that alters how surgery works.

Get it now: http://steamcommunity.com/sharedfiles/filedetails/?id=751352140

Non-steam link (and source code): https://bitbucket.org/twoski/rimworldmods/downloads

Licensing:

You may include this mod in a modpack, however do keep in mind that i may update it. It is better if you add this to a steam-based modpack since steam automatically updates when i submit my changes.

You may derive from this mod but please add a visible link to this mod if you do.

man, this mod is amazing! i know a ton of people who dont like it when there is a surgey on a leg and they accidentally cut a patients heart out :P
Logged

Linq

  • Colonist
  • ***
  • Posts: 571
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #2 on: August 25, 2016, 12:17:14 AM »

A word of advice, twoski: You don't need to copy every part of MedUtil over to your mod. You can simply do the following:

Code: [Select]
                var MedicalRecipesUtility = Type.GetType("RimWorld.MedicalRecipesUtility, Assembly-CSharp, Version=0.14.6054.28275, Culture=neutral, PublicKeyToken=null");
                var restore = MedicalRecipesUtility.GetMethod("RestorePartAndSpawnAllPreviousParts", BindingFlags.Static | BindingFlags.Public);
                if(restore != null)
                    restore.Invoke(MedicalRecipesUtility, new object[] { pawn, part, billDoer.Position });
                else
                    Log.ErrorOnce("Unable to reflect MedicalRecipesUtility.RestorePartAndSpawnAllPreviousParts!", 305432421);

This will make it easier to tell what's part of the mod and what's not so I can make Psychology compatible with it. Also, you can detour your modified MedUtil methods (if there are any) straight into MedUtil that way to make it even easier.

Also, fantastic mod, one of those things that makes you wonder why it's not vanilla.

P.S. Please remove instadeath on surgery failure.

e: On second thought, it would be easier for you to build compatibility into your mod than mine. Please add this code to your build and tell users to load your mod after Psychology:

Code: [Select]
CheckSurgeryFail:
            if (!patient.Dead)
            {
                TryGainBotchedSurgeryThought(patient, surgeon);
            }
            else
            {
                ThoughtDef kp = ThoughtDef.Named("KilledPatientBleedingHeart");
                if(kp != null)
                    surgeon.needs.mood.thoughts.memories.TryGainMemoryThought(kp, patient);
            }

ApplyOnPawn:
                MedUtil.RestorePartAndSpawnAllPreviousParts(pawn, part, billDoer.Position);
                ThoughtDef rp = ThoughtDef.Named("ReplacedPartBleedingHeart");
                if (rp != null)
                    billDoer.needs.mood.thoughts.memories.TryGainMemoryThought(rp, pawn);
« Last Edit: August 25, 2016, 01:22:20 AM by Psychology »
Logged

MoatBordered

  • Drifter
  • **
  • Posts: 25
  • Probably Dain Bramaged
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #3 on: August 25, 2016, 12:53:31 AM »

Looks promising.

I just have to change the <workerClass> of mod surgeries so they use your surgery changes, right?
Logged

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #4 on: August 25, 2016, 07:41:08 AM »

Yes,  all i did was make new worker classes that inherit from old ones.

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #5 on: August 25, 2016, 07:43:11 AM »

I will add reflection in.  I ended up copying stuff to my own util class because a lot of things are internal or cannot be called from my mod and i got lazy.
« Last Edit: August 25, 2016, 05:25:44 PM by twoski »
Logged

Linq

  • Colonist
  • ***
  • Posts: 571
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #6 on: August 25, 2016, 03:05:31 PM »

Reflection allows you to access internal/private methods and classes so you don't have to reduce compatibility by overwriting those fields and methods.
Logged

SpaceDorf

  • Transcendent
  • *****
  • Posts: 4083
  • Secretly Captain Obvious
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #7 on: August 25, 2016, 06:45:15 PM »

The obvious question has not been asked yet :)

Does it work with DESurgery ?
Logged
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #8 on: August 25, 2016, 07:14:58 PM »

my mod changes RecipeDefs for most surgery types. So if other mods do this too, then there's gonna be a problem

it likely won't cause crashes but if another mod overrides my mod's RecipeDefs then my mod effectively does nothing

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #9 on: August 25, 2016, 07:31:18 PM »

Could someone here give me a quick tip on how to add text note at the top left of the screen? Like when you fail a surgery and it says "[Pawn] failed their surgery in a minor way" up there.

Deimos Rast

  • Colonist
  • ***
  • Posts: 232
  • Refugee
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #10 on: August 26, 2016, 04:17:10 PM »

this looks like it has a lot of what I want, but I think I'll wait for compat with DE surgeries
might be hard to do from reading over this it sounds like
Logged
#StopPluginAbuse

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #11 on: August 26, 2016, 07:28:00 PM »

I'd have to look at DE surgeries and see what it does exactly but chances are they will conflict.

Aristocat

  • Colonist
  • ***
  • Posts: 365
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #12 on: August 30, 2016, 06:15:23 AM »

I haven't used this, but I would like to integrate this into my mod pack. Since I use DEsurgeries and EPOE I can probably make them compatible.
« Last Edit: August 30, 2016, 06:23:44 AM by Aristocat »
Logged

twoski

  • Colonist
  • ***
  • Posts: 264
    • View Profile
    • nuke.sexy
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #13 on: August 30, 2016, 09:28:21 AM »

I haven't used this, but I would like to integrate this into my mod pack. Since I use DEsurgeries and EPOE I can probably make them compatible.

sure

l2evy

  • Drifter
  • **
  • Posts: 43
  • Mod Maintainer
    • View Profile
Re: [A14] Improved Surgery - Now with 25% More Gangrene
« Reply #14 on: August 30, 2016, 11:00:00 AM »

I haven't used this, but I would like to integrate this into my mod pack. Since I use DEsurgeries and EPOE I can probably make them compatible.

EPOE and DESurgery Support for this mod I would def use it. Surgery would be even more fun then!
« Last Edit: August 30, 2016, 11:04:24 AM by l2evy »
Logged
Mod Maintainer/Coder of:
Pages: [1] 2 3 ... 7