RimWorld

RimWorld

More Linkables
This topic has been locked
craze 16 Sep, 2020 @ 7:06pm
Improved xml selectors and mod patch compatibility.
So, I've made some changes to the more linkables xml selectors. To put this in the most straightforward way, these changes reduce load time for the mod by a factor of five, and remove the need for over 50 statically defined mod patches, while not compromising or sacrificing any functionality.

The altered selectors now use wildcards to automatically add the new linkables to any building(vanilla or mod) that supports one of the vanilla linkables of the same type. Specifically, the vitals monitor is used to determine which things get the medical linkables, the multi analyzer is used to determine which things get the research linkables, and the general work speed boosting tool cabinets are added to anything utilizing the vanilla one. The cupboard, being generally seen as an 'alternative' to the tool cabinet where appropriate, still has to be statically patched onto the various defs that utilize it, as a replacement.

The remaining 18 mod patches were modified, and serve only to add linkables to production facilities which did not originally support any, or to swap out the references to the vanilla tool cabinet in favor of the kitchen cupboard on any food related buildings, prior to the aforementioned wildcard patch getting run. The vanilla patch file has been renamed to 'zzCore.xml' to ensure that it runs last, so that any of the specific mod patches which replace references to the tool cabinet can do so beforehand, and prevent the extra cabinets from being added when they otherwise shouldn't be. Consequently, this also fixes a bug with the original patch for the vanilla butcher table, which was overwriting the changes made by other mods due to replacing the entire comps block.

Here are the remaining mod patches. I have not been able to test them all due to not having the relevant mods, but generally speaking, they are nearly identical to one another now, and aside from any potential syntax errors I may have overlooked(which would be trivial to fix - though I don't believe there to be any), they should work:
  • Callistans.xml
  • Crystalloid.xml
  • Electric Butcher Table.xml
  • Fertile Fields.xml
  • Glittertech.xml
  • GloomyFurniture.xml
  • Medieval Times.xml
  • More Batteries.xml
  • More Floors.xml
  • RimCuisine.xml
  • RimPlas.xml
  • RimWriter.xml
  • Small Workbenches.xml
  • TiberiumRim.xml
  • Tiny Workbenches.xml
  • Vanilla Furniture Expanded.xml
  • Vegetable Garden Project.xml
  • What the hack.xml

You should no longer have to manually make static mod patches to add the new linkables to workbenches added by a mod, unless the workbench in question does not utilize any of the vanilla linkables. Everything else is now patched automatically via wildcard.

...Speaking of wildcards, please never, EVER start your xml selectors with an asterisk, for any reason. If you have to ask what the proper use case is for that, then you don't need it. It's hideously slow and needless. Every selector in the mod was written that way(along with all ~70 of its patches for various mods), and according to the profiler found in the 'Startup Impact' mod, more linkables was clocking in at over 1.5 seconds to load. Not much in the grand scheme of things, until you consider that of the other ~320 mods I have loaded, only about 10 of them have load times of over half a second, and two of those are from CE. Most mods with a decent amount of patches clock in at the 100-250ms range. For reference, Core takes 5.84 seconds to load on my system, while the un-edited copy of more linkables was taking over 1.5 seconds.

I've zipped up the contents of the overhauled patches folder from the mod, and uploaded it to catbox. Just delete the existing files in the folder and replace them with mine: https://files.catbox.moe/c34sp6.zip

One last thing to note, is that this patch was written about a week ago, and I've been testing it locally since then. I know that there have been one or two updates(primarily for mod compatibility) since that point, so you will potentially need to merge some changes back to my provided files, depending on what kind of patches you added - if the mods even require custom patches at all anymore.

Hopefully this helps you going forward.
Last edited by craze; 16 Sep, 2020 @ 8:41pm