Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - DoctorVanGogh

#1
Releases / [B19] ModSwitch - a Rimworld mod manager
September 19, 2017, 07:28:54 PM

ModSwitch

A Rimworld mod manager.

Allows you to

  • Restore a saved list of mods
  • Save the current list of active mods
  • Load a ModSet from a savegame
  • Colorize mods in the mod list for better organization
  • Can import ModListBackup settings
  • 'Copy local' options for Steam workshop mods. Also copies the mod's settings. Allows manual updates of such local copies to the current version on steam.
  • (Somewhat assisted) installation help for missing mods
Installation
Subscribe on Steam
Get the mod from the github project page.

Changelog

Version 0.19.1.5a
- B19 release

Version 0.18.1.4:
- B18 support
- new versioning scheme (game-major.game-minor.mod-major.mod-minor) - let's see how this works

Version 1.3:
- New option: Import ModSet from savegame
- Support sorting/reordering ModSets though Drag & Drop in Settings
- Deferred restarts when active Mods have changed (actual new/load game still forces a restart)
- Restore version mismatch hint in ModConfig (Mod coloring does hide vanilla coloring for outdated mods)
- Improved ModListBackup import: Import backup *names* too
- Fix rare potential error on MLB import
- Fix error with 'overwrite' option for new ModSets when no ModSets exist

Version 1.2:
- Adds a search bar to the mod list
- Remembers the original steam mod for mods copied locally and supports *manually* upgrading to the latest steam version (if available)
  (To manually set a steam source for an already created local copy hold SHIFT before opening the right click menu on the copy)
- Can overwrite existing mod sets when creating a new snapshot

Version 1.1:
- Added 'copy local' to mods from Steam. Also copies settings for the duplicated mod.
Version 1.0a:
- Fixed some minor initialization issue


If you snuck in and downloaded the now removed 1.0 version, grab 1.0a - it fixes a tiny issue that only happens if you never used any of the alpha builds.

Feature requests
From the 'unfinished' thread:
  • A limited set of custom colors
  • Drag/drop improvements

    Bugs & issues

    Please report any errors or issues here or on the github issue tracker.

    License:
    This mod is licensed under CC BY-NC-SA 4.0





    Thanks to scuba156 for his ModListBackup - whatever the issue is with that mod, and if it is available or not, maintained or not, this one is under a license that will allow it to stay alive even if I get hit by a truck (happy now erdelf? ;) )
#2
Since ModListBackup is no longer with us, and I really, really want the core functionality, I've hacked together an absolute bare bones basic feature-complete replacement.

Updated with new release info

Currently implemented features:

  • Import ModListBackup definitions (Sorry, just the mods, not the 'custom' name for the set yet - also, no colors for now).
  • Apply sets of active mods with one button.
  • Saving mod sets
  • Renaming sets
  • Deleting sets
  • Localization

Things to do (obviously a lot less):

  • Assisted (automated?) subscription to Steam mods not currently subscribed* - maybe later
  • Auto-switching mod sets on game load if there is a mismatch - definitely later
  • "Fancified" UI - meh.... later :D

To avoid a similar drama as with MLB I've decided to put ModSwitch under a permissive license from the start (CC BY-NC-SA 4.0) even though it's nowhere near finished or even feature complete. So if I get hit by a bus tomorrow, the thing is still there.

I'll put the mod on steam probably in less than a week - so for those precious few days steam-only users will have to either live without a mod switcher or jump into the deep end and download a zip file :D

Project page: https://github.com/DoctorVanGogh/ModSwitch
Download: https://github.com/DoctorVanGogh/ModSwitch/releases

I'd also like to say a big thank you to scuba156 who did the original ModListBackup. That thing saved me hours of tedious clicking. Also - please don't take my license choice as any sort of criticism of scuba or his (her?) mod(s). They're his baby, and he's free to do with them whatever he likes.




*: I'm really reluctant to add any 'auto-subscription' routine to my mods. So in the end it'll most likely 'just' open up the steam browser for missing mods where you can subscribe yourself.
#3

Reclaim, Reuse, Recycle

Rimworld mod that allows extracting added parts (aka Bionics, Peg legs, etc) & implants from corpses.

This mods basically adds two types of jobs/recipes:

  • A set of "Harvest corpse" jobs at the Butcher & Machining Tables which will try to extract all recoverable artificial body parts.
  • A set of "refurbish" type jobs on the Drug Lab which will transform extracted parts into fully reusable body parts again.
There are research projects unlocking the different jobs.

Installation
Subscribe on Steam
Get the mod from the github project page.

Changelog

Version 0.19.1.4:
- B19 release
- Improved Textures by Syrchalis

Version 1.0.1.4:
- 1.0 unstable support

Version 0.18.1.3:
- B18 support
- New versioning scheme (game-major.game-minor.mod-major.mod-minor)...
- Harvesting & Refurbishment are now done at dedicated workbenches.
Those benches have a massive bonus to workspeed & harvesting success chance if installed adjacent to each other.
(Textures not 100% final)
- Harvesting & Refurbishment are their own dedicated work types (located under Crafting).

Version 1.0.1:
- Non corpse corpses are no longer valid harvesting targets. No more carving up shellfish looking for implants.
- Removed the specialized workGivers for harvesting. For the time being harvesting will count as butchering/crafting.



Basic concepts

Extracted part status

Reclaimed parts (which can be any added part or implant that could be removed from a corresponding live pawn) are either extracted in a non-sterile or mangled variant. Undamaged (or slightly damaged) parts are extracted as non-sterile, while moderately damaged parts get extracted as mangled versions. The thresholds for non-sterile/mangled/no extraction can be changed in the mod options. (Defaults are 100%-85%: non-sterile, 85%-50%: mangled, otherwise: non reclaimable).
Non-sterile parts only need the part and medicine to be usable again, while mangled parts need additional material(s) for restoration.



Non-SterileMangled

Extracted part 'Complexity'

Parts are categorized by Complexity (a visible stat on the reclaimed part). Available levels are

  • Primitive
  • Advanced
  • Glittertech

This complexity is derived from the extracted part by internal tags, techlevel or ultimately price and should account for all mod-added parts.
Each complexity level corresponds to the medicine (and possibly other materials) needed to make the part usable again. Primitive needs Herbal Medicine (plus wood/cloth), Advanced uses regular Medicine (plus steel/components) and Glittertech requires Glitterworld Medicine (plus components & plasteel).

Harvesting Jobs

Extraction is a composite job that will always try to remove all possible parts in a corpse.
The extraction can fail and that failure is calculated per part. Failures work similar to surgery and are in fact calculated from the surgery/mechanoid extraction success chance of the executing pawn. Success chance is multiplied by 1.5 compared to regular surgeries to accomodate for the composite nature of the harvesting job as well as the lack of 'supporting' medicine (Room stats still apply for biological harvests).
A minor failure will typically still allow extraction of a (mostly) undamaged part, while catastrophic failure will almost certainly destroy the part.

Changes to vanilla behavior

This mods adds special filters to the corpse categories for fully harvested corpses and corpses with parts of a certain complexity.
Harvested corpses contain no reclaimable parts, while Unharvested corpses ultimately could have (some) parts removed.
The vanilla Butcher corpse job get's changed to only use Harvested corpses by default. If you want to make it use any corpse, make sure to activate Unharvested corpses too (but why would you?).

Compatibility

Mod load order should not matter for this mod. It also should support any and all additional parts from 3rd party mods.
Quote from: SpaceDorf on August 05, 2017, 10:24:05 PM
from experience I have no conflicts with :
XeoNovaDans Surgery Tweaks, Better Surgery,Birds and Bees,  Children and Pregnancies, DESurgeries, RBSE-Hardcore, Epoe, ADogSaid, EPOE Limb Harvesting, Harvest Everything, JTFieldSurgerie, More Consumables and Mutagens, Malfunction, Mod Medicine Patch, Quality Surgeon, sd_medicaddons, fluffies medical tab and of course :

Ushanka!

what I have not tried so far is Craftable Mutants and the Extended Human Body Simulation but since it is based on epoe ..

-----

@Doc you may quote me on that and refer all complaints to me.

While the complexity might not be 100% as expected for 'weird' extra parts it will always guess something and thus allow reclamation & reuse of the part(s).

Some remarks:

I've decided against simply 'vomiting' out the final usable bionics directly in the harvesting job, since that makes bionic acquisition way too easy. But now with this mod you have the option to reclaim those parts you want - or if you feel like making a recycling industry out of your raiders, you can do that - it's just a bit more involved than 'Click, get bionics' .


Bugs & issues

Please report any errors or issues here or on the github issue tracker.

License:
This mod is licensed under CC BY-NC-SA 4.0
#4
This is a bug in Rimworld core, but can only be exposed by a mod - any mod.

If you create a RecipeDef (doesn't matter if in xml or an assembly) it is perfectly valid to create that Recipe without any ingredients.

Code (xml) Select

<RecipeDef>
<defName>Bar</defName>
<products>
<WoodLog>1</WoodLog>
</products>
</RecipeDef>


If you then try to use DebugTools and check all the recipes, this will cause an InvalidOperationException:

Exception filling window for Verse.Dialog_DebugLogMenu: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.First[IngredientCount] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Verse.DataAnalysisTableMaker.<DoTable_Recipes>m__9AC (Verse.RecipeDef d) [0x00000] in <filename unknown>:0
  at Verse.DataAnalysisTableMaker+<DoTable_Recipes>c__AnonStorey56F.<>m__9B2 (Verse.RecipeDef d) [0x00000] in <filename unknown>:0
  at Verse.DebugTables.MakeTablesDialog[RecipeDef] (IEnumerable`1 dataSources, Verse.TableDataGetter`1[] getters) [0x00000] in <filename unknown>:0
  at Verse.DataAnalysisTableMaker.DoTable_Recipes () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at Verse.Dialog_DebugLogMenu+<DoListingItems>c__AnonStorey5D1.<>m__BAB () [0x00000] in <filename unknown>:0
  at Verse.Dialog_DebugOptionLister.DebugAction (System.String label, System.Action action) [0x00000] in <filename unknown>:0
  at Verse.Dialog_DebugLogMenu.DoListingItems () [0x00000] in <filename unknown>:0
  at Verse.Dialog_OptionLister.DoWindowContents (Rect inRect) [0x00000] in <filename unknown>:0
  at Verse.Window+<WindowOnGUI>c__AnonStorey2C4.<>m__1B1 (Int32 x) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.<WindowOnGUI>c__AnonStorey2C4:<>m__1B1(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle)


Turns out DataAnalysisTableMaker.DoTable_Recipes() (or rather one of it's inline delegates) makes an assumption that there is always at least one ingredient defined on a recipe:
Quote from: decompiled code, so may not be 100% correct
   ...
   Func<RecipeDef, float> cheapestProductsVal = delegate(RecipeDef d)
   {
      ThingDef thingDef = d.ingredients.First<IngredientCount>().filter.AllowedThingDefs.MinBy((ThingDef td) => td.BaseMarketValue);
      float num = 0f;
      foreach (ThingCountClass current in d.products)
      {
         num += current.thingDef.GetStatValueAbstract(StatDefOf.MarketValue, (!current.thingDef.MadeFromStuff) ? null : thingDef) * (float)current.count;
      }
      return num;
   };
   ...
You'll probably want to use a FirstOrDefault there instead (If there's no ingredient there's nothing to use as stuff).

I've attached a 'demo' mod that triggers the issue.






[attachment deleted by admin: too old]
#5

Since theubie seems to be MIA and does not update his wonderful Deep Core Miner I went ahead and published an Alpha 17 version with some (minor) improvements. After writing three separate 'special material addon X' mods, I went ahead and made the drill simply support any mineable materials out of the box.

So, without further ado - here's OCD - "the one drill to screw them all" ;D No more Addons needed.

  • Subscribe on Steam
  • Project hosting/issue tracker on Github

New Feature with 2.1:
Drill how much you want!


As for the rest - I'll leave you (mostly) with thuebie words for his original mod.

Changelog:

Version 0.19.2.3a
- B19 version

Version 1.0.2.3
- 1.0 version
- custom drill graphic
- added 'unfinished drill plans' to stop/resume drill work

Version 0.18.2.2:
- B18 support
- new versioning scheme (game-major.game-minor.mod-major.mod-minor)

Version 2.1
- In-game configuration interface for work/yield values per material

Version 2.0
- Explicit A17 support
- Supports arbitrary mineable rock types (Including mod added rock types)
- Tweaked a lot of mining recipes (work required/yield returned) as a result of auto generated recipes. For details see project page on github
- Moved interaction cell outside drill - now your pawns can sit in those comfy human leather armchairs while they mine.
- Use 'drilling' animation/sound
- Made drill use mining speed & mining yield stats of operating pawns correctly


What this mod is:
A deep core driller capable of pulling out any mine-able material you want, given enough power and work by your pawns. Doesn't matter if it's from vanilla or a mod. If it can occur as a mine-able rock on a map, the drill knows how to extract it.

Required Deep Drilling research from vanilla core. Should be compatable with most other mods.

Requires a substantial steel and plasteel investment. Also is quite a bit power hungry. The acutal process takes a while, since you're drilling deep into the core. To balance out the "infinte pool of resource" side, your returns are fairly small, but given enough power and time you can create a fully sustainable industry for your colony.

Idea Credit:
Original Deep Driller Mod by thebie

Add-ons:
No longer necessary :D

FAQ:

What are the requirements for this mod?

No special requirements.  This mod does not depend on any other mods.  You can run this and the game core just fine.

How do I install this mod?

If you're using Steam find this mod in the Steam workshop and subscribe.
Or download the zip from the source repository and unzip its contents into your mods folder.


What order should your mod be loaded in?

The base mod can be loaded anywhere after the game's core mod.  It does not depends on any other mod to function.

Are there any known issues?

There are no known issues at this time.

This mod does add a jobgiver, so it has a tendency to freak out any pawns who are currently active in jobs if added to a saved game.  There is a work around (use dev mode to down the pawn and heal them back up) or you can of course create a new game.

Can this mod be used with old saves?

The base mod was able to be added to a vanilla old save with no issues.  There were some issues with a very heavily modded old save, but runs fine with the same list of mods on a new save.  Conclusion:  use on old saves at your own risk.  See above.

License:
This mod is licensed under CC BY-NC-SA 4.0


#6
This is a bug in vanilla Rimworld, but it's only exposed when you install certain mods - so no idea if this is the right place or the Mods subsection.
---
If you have pawns that are non-people who try to feed an incapacitated prisoner from a nutrient dispenser you get an error in the log on every job:

Exception in BreadthFirstTraverse: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.FoodUtility+<BestFoodSourceOnMap>c__AnonStorey259.<>m__1 (Verse.Thing t) [0x00000] in <filename unknown>:0
  at Verse.GenClosest+<RegionwiseBFSWorker>c__AnonStorey5FC.<>m__BFF (Verse.Region r) [0x00000] in <filename unknown>:0
  at Verse.RegionTraverser+BFSWorker.BreadthFirstTraverseWork (Verse.Region root, Verse.RegionEntryPredicate entryCondition, Verse.RegionProcessor regionProcessor, Int32 maxRegions, RegionType traversableRegionTypes) [0x00000] in <filename unknown>:0
  at Verse.RegionTraverser.BreadthFirstTraverse (Verse.Region root, Verse.RegionEntryPredicate entryCondition, Verse.RegionProcessor regionProcessor, Int32 maxRegions, RegionType traversableRegionTypes) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.RegionTraverser:BreadthFirstTraverse(Region, RegionEntryPredicate, RegionProcessor, Int32, RegionType)
Verse.GenClosest:RegionwiseBFSWorker(IntVec3, Map, ThingRequest, PathEndMode, TraverseParms, Predicate`1, Func`2, Int32, Int32, Single, RegionType, Boolean)
Verse.GenClosest:ClosestThingReachable(IntVec3, Map, ThingRequest, PathEndMode, TraverseParms, Single, Predicate`1, IEnumerable`1, Int32, Int32, Boolean, RegionType, Boolean)
RimWorld.FoodUtility:BestFoodSourceOnMap(Pawn, Pawn, Boolean, FoodPreferability, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
RimWorld.FoodUtility:TryFindBestFoodSourceFor(Pawn, Pawn, Boolean, Thing&, ThingDef&, Boolean, Boolean, Boolean, Boolean, Boolean)
RimWorld.WorkGiver_FeedPatient:HasJobOnThing(Pawn, Thing, Boolean)
AIRobot.<>c__DisplayClass1_1:<TryGiveJob>b__0(Thing)
Verse.<RegionwiseBFSWorker>c__AnonStorey5FC:<>m__BFF(Region)
Verse.BFSWorker:BreadthFirstTraverseWork(Region, RegionEntryPredicate, RegionProcessor, Int32, RegionType)
Verse.RegionTraverser:BreadthFirstTraverse(Region, RegionEntryPredicate, RegionProcessor, Int32, RegionType)
Verse.GenClosest:RegionwiseBFSWorker(IntVec3, Map, ThingRequest, PathEndMode, TraverseParms, Predicate`1, Func`2, Int32, Int32, Single, RegionType, Boolean)
Verse.GenClosest:ClosestThingReachable(IntVec3, Map, ThingRequest, PathEndMode, TraverseParms, Single, Predicate`1, IEnumerable`1, Int32, Int32, Boolean, RegionType, Boolean)
AIRobot.X2_JobGiver_Work:TryGiveJob(Pawn)
Verse.AI.ThinkNode_JobGiver:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_PrioritySorter:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
RimWorld.ThinkNode_Conditional:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.Pawn_JobTracker:DetermineNextJob(ThinkTreeDef&)
Verse.AI.Pawn_JobTracker:TryFindAndStartJob()
Verse.AI.Pawn_JobTracker:JobTrackerTick()
Verse.Pawn:Tick()
AIRobot.X2_AIRobot:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

While there's non vanilla code in the stack trace, the bug itself is completely from the base game.

RimWorld.FoodUtility+<BestFoodSourceOnMap>c__AnonStorey259.<>m__1 (or in non-decompiled source, just the RimWorld.FoodUtility.BestFoodSourceOnMap method) contains code near the bottom of:
Quote
...
Predicate<Thing> predicate = (Thing t) => foodValidator(t) && !FoodUtility.filtered.Contains(t) && t.def.ingestible.preferability > FoodPreferability.DesperateOnly && !t.IsNotFresh();
Predicate<Thing> validator = predicate;
bool ignoreEntirelyForbiddenRegions = flag;
thing = GenClosest.ClosestThingReachable(getter.Position, getter.Map, thingRequest, PathEndMode.ClosestTouch, TraverseParms.For(getter, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, null, 0, searchRegionsMax, false, RegionType.Set_Passable, ignoreEntirelyForbiddenRegions);
...
If the feeding pawn is a person this line never seems to be reached, the code exits early. With non-person pawns this check is run, and subsequently blows, since it's invoked with a Nutrient dispenser for the Thing - which has no ingestible, so access to it's preferability blows.

A simple fix would be a change of the highlighted piece to t.def.ingestible?.preferability > FoodPreferability.DesperateOnly to prevent any errors. But probably there's a substitution to the dispensed nutrient meal's properties intended there, like in earlier parts of the method.

Demo savegame (needs Miscellaneous 'CORE', Misc. Robots & Misc. Robots++): https://drive.google.com/open?id=0B2GJ6pU1K8cKYldGTTY0bXctYlE

Just hit the Activate gizmo on the ER bot to awake it and have it start the feeding jobs and trigger the error.



Offtopic: This contains a bare minimum savegame with a 5% world as an ultra compression 620kb 7zip.... How is this supposed to fit in 600kb as an attachment? ;)

Moderator's edit (Calahan)
Quote from: DoctorVanGogh on July 06, 2017, 11:31:22 PM
How is this supposed to fit in 600kb as an attachment? ;)
By using some 7zip wizardry to get it down to 540kb :D 

[attachment deleted by admin due to age]
#7
In vanilla Rimworld A17 there's a bug that causes an error whenever a non-person pawn butchers a humanlike corpse. You'd typically only see this if you have specialized pawns in your colony (for example from Misc Robots/Misc Robots++).

This mod removes the error. Just install/subscribe and put as far up in mod load order as possible.

Download: Get this mod from github or steam.





#8
If you butcher a humanlike corpse with a pawn that does not have a 'mood' need (Example: Alaestor's Robots++ 'Kitchen Bot') the butcher job will throw an error, not complete (and restart again, to just cause another error again & again & again....)


System.NullReferenceException: Object reference not set to an instance of an object

(Triggered inside Corpse.<ButcherProducts>c__Iterator22C.MoveNext())

Since I'm currently writing a mod that mucks around in the butchering jobs, and thus am knee deep in (code) guts anyway I took a look and found the cause of the bug:

The Corpse.ButcherProducts Iterator does not check if the butchering pawn does actually have a non-null 'mood' property before trying to add a 'ThoughtDefOf.ButcheredHumanlikeCorpse' thought. Thus this instruction blows, and the method never completes.
The code does check all pawns who should get a 'ThoughtDefOf.KnowButcheredHumanlikeCorpse' debuff ;)

I've actually put together a bugfix mod that includes code which correctly catches this condition (needs a C# 6.0 capable compiler, otherwise you'll have to manually unfold all those '?.' null propagations).
#9
Help / Injected/dynamic Defs & stockpile (filters)
June 24, 2017, 04:10:05 AM
I'm working on an assembly based mod that'll probably create tons of runtime generated Defs.

I've got things working insofar that I can create all the ThingDefs I need, I can spawn the items in (using debug mode) and they happily persists though saves.

Just for the life of me I cannot get the new Defs to show up in stockpile filters. If I do an xml based definition like
Code (xml) Select
  <ThingDef>
    <defname>R3Bar</defname>
    <label>R3Bar</label>
<thingClass>ThingWithComps</thingClass>
<category>Item</category>
<description>This is an R³ bar item</description>
    <thingCategories>
      <li>BodyPartsReclaimed</li>
      <li>BodyParts</li>
    </thingCategories>
    <graphicData>
        <texPath>Things/Item/BodyPart/Organ</texPath>
        <graphicClass>Graphic_Single</graphicClass>       
    </graphicData>
<comps>
<li Class="CompProperties_Forbiddable"></li>
</comps>   
    <selectable>true</selectable>
  </ThingDef>
it'll happily appear in the filter.

If I do the code equivalent of
Code (csharp) Select

var foo = new ThingDef {
defName = "R3Foo",
label = "R3Foo",
thingClass = typeof(ThingWithComps),
category = ThingCategory.Item,
description = "This is an R3 foo item",
thingCategories = new List<ThingCategoryDef> {
   DefDatabase<ThingCategoryDef>.GetNamed("BodyParts"),
   DefDatabase<ThingCategoryDef>.GetNamed("BodyPartsReclaimed"),
   },
graphicData = new GraphicData {
   graphicClass = typeof(Graphic_Single),
   texPath = "Things/Item/BodyPart/Organ"
   },
comps = new List<CompProperties> {new CompProperties_Forbiddable()},
selectable = true,                         
};

InjectedDefHasher.GiveShortHasToDef(foo, typeof(ThingDef));
DefDatabase<ThingDef>.Add(foo);

it wont show.

What am I doing wrong? Do I need to call some method to force a refresh/rebuild on the filter tree?
I tried doing things by hand (deriving from Mod) and using HugsLib (which talks about injected Defs in their DefsLoaded override so expected more success there) - sadly things just don't work yet.

I can see a really convoluted rube-goldberg injection method of writing a custom xml def file inside the mod directory on assembly load, then creating a DefPackage for that, adding it to the ModContent and hoping this works.... But honestly, that's just plain wrong.... Besides, I fully expect this to fail too.

So... Any ideas? Suggestions? Any working examples out there?

[attachment deleted by admin due to age]
#10
I've put together a small mod prototype that extends butcher jobs to also return any installed parts from corpses. Basically what's visible in the corpse's "Health" tab and is artificial comes out when the corpse is butchered.

I've seen some remarks that this would be technically infeasible, but from the code I've seen this is almost trivially easy. I'm running this locally with EPOE, A dog said and some other mods that add parts, and am seeing zero issues.

If you want to give it a try, here's the public github repository including releases.

Ideas about possibly extensions I've got so far:

  • Reclaimed parts pop out with their 'damage' carried over. (Corpse with 'Bionic leg' damaged to 30% hitpoints, 'Bionic leg' on ground has 30% of max hitpoints). Problem: Parts get installed at 100% health, no matter the hitpoints of the implant before installation.... So it's kinda pointless...
  • Maybe add minor/catastrophic fail chances like in operations and mechanoid operations. Would need to decide on skill to use. Butchery? Medicine? Combination of the two? Again: Minor failure would lead to damaged part... which would be pointless once reinstalled...
  • Don't pop out usable parts, but some sort of 'reclaimed XYZ' item. Add work table/jobs to transform those back into usable parts. No idea how feasible
  • 'Icky' debuff on corpse parts like deadman's clothes. Scope almost guaranteed to be too big for a mod.... Also, where's the distinction between an artificial liver where the removal actually killed the prisoner and the same item removed after prisoner execution. Possibility for interesting drama though ;)

If any issues crop up, post them here or on the github issue tracker.