Recipe available only after research

Started by sefin_88, August 07, 2016, 05:39:16 AM

Previous topic - Next topic

sefin_88

If I wanted to make a repair recipe available only after the required research was done for the item.  Where would I put the script?

<researchPrerequisite>RESEARCHnameHERE</researchPrerequisite>

does it matter where this line goes or does it have to be in a certain place in the recipe def?

sefin_88

I worked it out.  I put the above line in the script after this line:
<soundWorking>Recipe_Machining</soundWorking>

and everthing works perfectly now.

1000101

It doesn't matter where in an xml block a tag is as per the xml standard.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

sefin_88

Quote from: 1000101 on August 07, 2016, 06:16:36 AM
It doesn't matter where in an xml block a tag is as per the xml standard.

Cool thanks for that.  I don't know much about scripting and such but I'm a quick learner.  Everything I know about xml stuff I have literally learned from here and modding other games within the past year.

1000101

Generally it's best to keep the tags in the same order they appear in the C# class they represent.  However, there is no requirement that they do so.  Sometimes however, related C# fields aren't adjacent in the C# class, in this case it's perfectly fine to move the xml tags around so they are together and make sense.

That being said, there are caveats with lists.  ThingComps can be very strict about the order they appear in.  CCL's CompPowerLowIdleDraw must be after the cores CompPowerTrader, for example.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Master Bucketsmith

I can't find any other topic or source that addresses this question.
I've got a shell that I make at the machining table, for a custom mortar.
I want the recipe/bill for making the shell to have requirements in research.

If I add:
<researchPrerequisites>
<li>Machining</li>
<li>Firefoam</li>
</researchPrerequisites>

To the Recipes_Production.xml file, I get an error in the debug window when booting up RimWorld.
If I add it to the Items_Resource_Manufactured.xml file, it does nothing.

To which file do I add those lines?

kaptain_kavern

I've a research and in Core the tag you talking about is only used on buildings item. But read the doc in CCL thread, I'm pretty sure their modified research system will have what you want

Master Bucketsmith

#7
Quote from: kaptain_kavern on August 12, 2016, 05:44:56 AM
I've a research and in Core the tag you talking about is only used on buildings item. But read the doc in CCL thread, I'm pretty sure their modified research system will have what you want
I just did that. I've tried adding the AdvancedResearchDef folder with file and code like this:
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

    <CommunityCoreLibrary.AdvancedResearchDef>

        <defName>MakeFoamShellsMachiningTable</defName>
        <Priority>0</Priority>

        <researchDefs>
            <li>Machining</li>
<li>Firefoam</li>
        </researchDefs>

        <recipeDefs>
            <li>MakeFoamShell</li>
        </recipeDefs>

        <thingDefs>
            <li>TableMachining</li>
        </thingDefs>

    </CommunityCoreLibrary.AdvancedResearchDef>

</Defs>

But upon booting RimWorld, it errors that it requires ModHelperDef.
If I look into that folder and file, I see nothing that is connected to AdvancedResearch or the artillery shell tweak in their Vanilla Tweaks mod.

Never you mind, I managed to work it out. Made all the needed files and folder structure and it's all working now! :)
Thank you!