RimWorld

RimWorld

Nanomachines, Son!
󠀡󠀡 Apr 27, 2022 @ 7:54pm
Noticed an issue when combined with prosthetics
Since prosthetic arm and legs technically remove a lot of parts of a pawn, like shoulders, arms etc., the heart tries to regenerate them, but fails and causes the following error:

Exception ticking hediff (NanomachinesSon_Heart heart ticksSinceCreation=12000) for pawn <pawn name>. Removing hediff... Exception: System.InvalidCastException: Specified cast is not valid.

And then the game removes the pawn's heart, though fortunately it doesn't kill them, only reverting their heart back to the boring normal one. Tested with both vanilla bionics, archotechs and new prosthetics from EPOE.

Any ideas on how to fix/prevent this?
< >
Showing 1-5 of 5 comments
I exist  [developer] Apr 28, 2022 @ 9:09pm 
It's unfortunately something I can't fix myself, since I'm no C# wizard, and the code I used for the healing of wounds like that comes from the Community Framework.
Amaxiros May 3, 2022 @ 8:58am 
Got the same problem with body parts removal. The saddest part is that you can partially fix it with the mod named "Prosthetic No Missing Body Parts", but only for arms and legs. The heart still removes itself. I am a complete zero in terms of code, so just in case i leave my error message for you. It would be a bless if it could help somehow.



Exception ticking hediff (NanomachinesSon_Heart heart ticksSinceCreation=60000) for pawn Jesus. Removing hediff... Exception: System.InvalidCastException: Specified cast is not valid.
at CF.CommunityHealthUtility.RestorePartRecursiveInt (Verse.Pawn pawn, Verse.BodyPartRecord part, System.Boolean& alreadyWarned) [0x00024] in <2a1fe854cdf84ca7a92e4e13fe10f54c>:0
at CF.CommunityHealthUtility.RestorePartRecursiveInt (Verse.Pawn pawn, Verse.BodyPartRecord part) [0x00002] in <2a1fe854cdf84ca7a92e4e13fe10f54c>:0
at CF.CommunityHealthUtility.RestorePartInt (Verse.Pawn pawn, Verse.BodyPartRecord part) [0x0000e] in <2a1fe854cdf84ca7a92e4e13fe10f54c>:0
at CF.CommunityHealthUtility.TryHealRandomPermanentWoundFor (Verse.Pawn pawn, Verse.HediffWithComps cause, System.Collections.Generic.List`1[T] blacklist, System.Collections.Generic.List`1[T] whitelist, System.Collections.Generic.List`1[T] sideEffects, System.Boolean canHealDestroyed, CF.InjuryRegenListMode injuryMode) [0x0016c] in <2a1fe854cdf84ca7a92e4e13fe10f54c>:0
at CF.HediffComp_HealPermanentWoundsConfigurable.TryHealPermanentWound () [0x0003e] in <2a1fe854cdf84ca7a92e4e13fe10f54c>:0
at (wrapper dynamic-method) CF.HediffComp_HealPermanentWoundsConfigurable.CF.HediffComp_HealPermanentWoundsConfigurable.CompPostTick_Patch0(CF.HediffComp_HealPermanentWoundsConfigurable,single&)
at Verse.HediffWithComps.PostTick () [0x00024] in <464202b7bbde412f9e6a1b26080987a9>:0
at (wrapper dynamic-method) Verse.Pawn_HealthTracker.Verse.Pawn_HealthTracker.HealthTick_Patch2(Verse.Pawn_HealthTracker)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
(wrapper dynamic-method) Verse.Pawn_HealthTracker:Verse.Pawn_HealthTracker.HealthTick_Patch2 (Verse.Pawn_HealthTracker)
(wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch4 (Verse.Pawn)
(wrapper dynamic-method) Verse.TickList:Verse.TickList.Tick_Patch2 (Verse.TickList)
(wrapper dynamic-method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch2 (Verse.TickManager)
Verse.TickManager:TickManagerUpdate ()
(wrapper dynamic-method) Verse.Game:Verse.Game.UpdatePlay_Patch1 (Verse.Game)
Verse.Root_Play:Update ()
Amaxiros Jun 14, 2022 @ 9:53am 
So i'd like to leave my solution to this problem in case someone else will face it in the future.
Try mod named "Medical System Expansion 2" https://steamcommunity.com/sharedfiles/filedetails/?id=2056706586. One of it's features - it kinda disables "removal" of body parts via implants, but not only for limbs. Hope it helps.
Last edited by Amaxiros; Jun 14, 2022 @ 9:55am
󠀡󠀡 Oct 26, 2022 @ 4:44am 
1.4 update dropped and I noticed the update says it won't try to regenerate replaced limbs. Fingers crossed!
Shlawg Jul 20, 2024 @ 2:46pm 
I know its been a while but has anyone found a way of fixing this?
< >
Showing 1-5 of 5 comments
Per page: 1530 50