[B18-A16] More Furniture

Started by Anonemous2, December 01, 2015, 06:54:52 PM

Previous topic - Next topic

SihvMan

Hey Anonemous2!

With A17, there's now a better way to add the linked facilities.

You can make a [Patches] folder in the top level of your mod folder and add and xml with xpath PatchOperations, like so;

RimWorld/Mods/A17MoreFurniture/Patches


<Patch>

<Operation Class="PatchOperationInsert">
<xpath>//ThingDef[defName = "SimpleResearchBench"]/label</xpath>
<value>
<comps>
<li Class="CompProperties_AffectedByFacilities">
<linkableFacilities>
<li>Anon2FileCabinet</li>
</linkableFacilities>
</li>
</comps>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "HiTechResearchBench"]/comps/li[3]/linkableFacilities</xpath>
<value>
<li>Anon2FileCabinet</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "Bed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "DoubleBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "RoyalBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "HospitalBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

</Patch>


This allows you to delete the research bench and bed defs from your ThingDefs, yet still have the facilities link.

This makes your mod then compatible with anything that also modifies those two def.

If you're interested, I can also whip up some patches for other furniture mods as they are updated to A17, and make them in such a way as to have them activate dynamically, based upon which ones are loaded.

kaptain_kavern

#106
Hi SihvMan,

Excuse me for "hijacking" this conversation but can you please point me to some docs or references for this "new method" you just explained?
I'm an "old" modder who have missed a couple of alphas...  ;)

Thank you in advance



PS: I found some infos, good ol' Zenthar provide some infos here ; https://ludeon.com/forums/index.php?topic=32181

SihvMan

Quote from: kaptain_kavern on May 20, 2017, 11:08:18 PM
Hi SihvMan,

Excuse me for "hijacking" this conversation but can you please point me to some docs or references for this "new method" you just explained?
I'm an "old" modder who have missed a couple of alphas...  ;)

Thank you in advance



PS: I found some infos, good ol' Zenthar provide some infos here ; https://ludeon.com/forums/index.php?topic=32181

Not a problem. The post you linked has most of the current guides and tips that any of us know on patching. For current (working) applications, check out the code I posted above (which I'm using for a modified local copy of A17 More Furniture), the Patch folder of my Bone Mod [https://ludeon.com/forums/index.php?topic=32560.0], and the thread between me and XeoNovaDan [https://ludeon.com/forums/index.php?topic=32645.0].

You can also PM me if you have any questions. I love your Thrumbo Wool mod. Keep up the good work.

kaptain_kavern

Thanks a lot for the pointers and the help proposal buddy.

When I will have more free time I will get back to the Modding Discord Server in order to gather some help if needed. But with what you provided I have enough to read and learn by tinkering by myself for a moment ;)

It is awesome, for an only-XML capable modder like myself. Now even my craziest projects seems more feasible, all by myself.  8) Now i'm back to study Xpath 101  :o

Thanks again for this

Anonemous2

Quote from: SihvMan on May 20, 2017, 10:30:52 PM
Hey Anonemous2!

With A17, there's now a better way to add the linked facilities.

You can make a [Patches] folder in the top level of your mod folder and add and xml with xpath PatchOperations, like so;

RimWorld/Mods/A17MoreFurniture/Patches


<Patch>

<Operation Class="PatchOperationInsert">
<xpath>//ThingDef[defName = "SimpleResearchBench"]/label</xpath>
<value>
<comps>
<li Class="CompProperties_AffectedByFacilities">
<linkableFacilities>
<li>Anon2FileCabinet</li>
</linkableFacilities>
</li>
</comps>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "HiTechResearchBench"]/comps/li[3]/linkableFacilities</xpath>
<value>
<li>Anon2FileCabinet</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "Bed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "DoubleBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "RoyalBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

<Operation Class="PatchOperationAdd">
<xpath>//ThingDef[defName = "HospitalBed"]/comps/li[1]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</Operation>

</Patch>


This allows you to delete the research bench and bed defs from your ThingDefs, yet still have the facilities link.

This makes your mod then compatible with anything that also modifies those two def.

If you're interested, I can also whip up some patches for other furniture mods as they are updated to A17, and make them in such a way as to have them activate dynamically, based upon which ones are loaded.

AWESOME  ;D

SihvMan

Quote from: Anonemous2 on May 21, 2017, 10:44:52 AM
Quote from: SihvMan on May 20, 2017, 10:30:52 PM
Hey Anonemous2!

With A17, there's now a better way to add the linked facilities.

You can make a [Patches] folder in the top level of your mod folder and add and xml with xpath PatchOperations, like so;

-Snip-

This allows you to delete the research bench and bed defs from your ThingDefs, yet still have the facilities link.

This makes your mod then compatible with anything that also modifies those two def.

If you're interested, I can also whip up some patches for other furniture mods as they are updated to A17, and make them in such a way as to have them activate dynamically, based upon which ones are loaded.

AWESOME  ;D

Here; have a better version of the patch code. This one has some checks to keep it working even if another mod completely overrides/butchers the base code, as well as dynamic patches for the beds from cuproPanda's Powerless and Rimrue's Tribal Essentials.

[attachment deleted by admin due to age]

Telkir

Just a quick note to say that both flavours of my MoreBeds mod will include integrated More Furniture compatibility. Yay for patches!  ;D

kittyhawk

Where may I find the link to the non-Steam A17 update? (sorry if I've missed something obvious) Thank you for your help.

Darkmark8910

Thanks y'all for the hard work!! :D Can't wait for these updates!

Or, well, I -can- wait, technically, without dying, but my life would be less-exciting without More Furniture in my life.

pktongrimworld

*wonder if anyone have a A17 working copy of more furniture lol

Constance68W

I'm not sure if the author is active on here anymore, I know we were lucky to get A16..

Buuuut this mod does work with A17, it adds an "Equipment Rack" with a big, red X through it.. Just don't place that and you'll be fine!


pktongrimworld


kittyhawk

#117
There is an A17 update on Steam... but the link to the non-Steam version was not updated (still links to A16).

Glad to know of the work around. Thanks!

eta: The author just posted last week. :)

deathstar

Quote from: Telkir on May 25, 2017, 03:58:51 PM
Just a quick note to say that both flavours of my MoreBeds mod will include integrated More Furniture compatibility. Yay for patches!  ;D

I'd say nay to patches, yay for built-in compatibility! Awesome, love both mods.

MMAciek

.


Stand among the millions of dead souls and ask them if they honor means something. Silence will be your answer.



.