Core and mod xpatching

Started by BigNBoss, October 27, 2018, 02:56:13 PM

Previous topic - Next topic

BigNBoss

Hello everybody,

I'm making a mod in 2 parts, the core and the mod itself.
I have a workstation in the core mod, but here is the problem.

I want, when only the core is enabled, that the workstation won't show up in the architect tab.
And when both of them are enabled, the workstation will show up.

Is there a command with "true" and "false" I could do this with?
I would change the "true" and "false" through xpatching.

BigNBoss
Check out my mods:
-Cigarettes mod

N7Huntsman

Firstly, I'm afraid I don't entirely understand the modding structure you're going for, nor what the benefit of it is. By 'core' are you referring to Rimworld's Core folder as found under Mods, or are you talking about something you made?

And, more generally speaking, if you only want the workstation to appear when both 'core' and 'the mod itself' are active, why not just put the workstation "in the mod itself" either as a separate Def, or by xpatching it into the def of the 'core'?
The Rim is a cruel place.

BigNBoss

Sorry for the poor explanation, let me try again.

I'm making a few mods, but they will all use the same modded workstation.
So I made a separate mod with only the workstation (="Core"), and just add the recipes through xpatching in the other mods (Recipes with modded items).

The problem:
If you only install the "Core" mod, the workstation will show up in the architect tab and I don't want this to happen.

If there is a command so it won't show up in the architect tab,
exp: <showup>false</showup>

I could change it status with xpatching if there is a mod installed.
exp: <showup>true</showup>

I just don't know if there is a command for that.

BigNBoss
Check out my mods:
-Cigarettes mod

N7Huntsman

I guess I don't really see the point in having the workstation itself packaged entirely separate from the recipes if A. it serves no purpose alone and B. you don't want to see it. I'm not really certain if there's a particular tag like you're asking for, but why even bother having the mod turned on at all in that case?

Additionally, you don't need to xpatch the recipes in unless you really feel the need to--they'll work just fine as independent Defs.
The Rim is a cruel place.

AileTheAlien

I think the closest thing you could do, is define your workstation in your central mod, in a way that it doesn't show up in the buildings menu (I forget which tag governs this, for buildings). You'd also want it not to show up in stockpile menus (another tag). Then, in your non-central mods, have the exact same patch, that adds both of those values to the workstation. (Alternately, just have the entire workstation definition in your patches; it'd be easier to read that way IMO.) The trick would be in your patches, only adding the tags if they don't already exist. Look for the PatchOperationSequence and PatchOperationTest patch stuff, in this section of this guide.

Also, like N7Huntsman said, if your recipes are only defined in your non-central mods, they don't need to be patches. Patching is a bit harder to read IMO, and possibly slower than normal defs, so you should use normal defs where they can be used.