Ludeon Forums

RimWorld => Mods => Help => Topic started by: FauxGrim on August 23, 2017, 08:11:37 AM

Title: Best way to hide core game objects/items?
Post by: FauxGrim on August 23, 2017, 08:11:37 AM
I'm trying to get into modding for the first time and wanted to rework a lot some of the basic items in the game like the default beds, default sleeping spots, default campfire +++.

In doing so I'm making new items within my mod but I would like to hide the default items so they are not visible / available to use from the get go (as they are today in the base game).

I managed to 'hide' them by creating a new empty def within my mod using the same <defName>, ParentName and <label> as the old default items and this successfully hides them from the game without critical Errors. However, the log reports the following errors: "Config error in Bed: Bed has null thingClass."

While I suspect I can solve some of it by adding a thingClass to the new empty def(at work, haven't tried yet), I am curious if there isn't a much better/proper way to disable/hide those items that I am overlooking?

Any help would be appreciated, thanks!
Title: Re: Best way to hide core game objects/items?
Post by: kaptain_kavern on August 23, 2017, 09:47:43 AM
If you want to hide some items while replacing some others, why not "just" named your new items exactly like the vanilla one? So yours overwrites vanilla.

To hide something you could also make that item required a tech that is impossible to research maybe
Title: Re: Best way to hide core game objects/items?
Post by: FauxGrim on August 23, 2017, 12:07:30 PM
Quotewhy not "just" named your new items exactly like the vanilla one?

For the sake of consistency and clarification I would prefer all my new items having names like <MyMod_ItemName> and rather have a separate file containing names and code for the default items that I have hidden. This will keep them separate and allow greater control. That is the idea, anyhow.

If I take an example:
I would like to add more granularity when it comes to beds. I think the following would be confusing:
#pseudocode
<beds>
MyMod_PrimitiveBed -> DefaultBed -> MyMod_SomethingMoreElaborateBed -> RoyalBed
</beds>


and would prefer something like this, if possible:

#pseudocode
<beds>
MyMod_PrimitiveBed -> MyMod_BasicBed -> MyMod_SomethingMoreElaborateBed -> MyMod_VeryElaborateBed
</beds>
<hidden>
DefaultBed
RoyalBed
</hidden>
Title: Re: Best way to hide core game objects/items?
Post by: CannibarRechter on August 23, 2017, 02:23:31 PM
If it were me, given the constraints you describe, I would follow kaptain_kavern's suggestion: I would look ever the tech dependency tree, define a new tech, and then use the patch operation Add command to add that new tech to the core item.  Try it with one of them, see if it works. I think it may.
Title: Re: Best way to hide core game objects/items?
Post by: FauxGrim on August 23, 2017, 03:58:39 PM
Yes, adding a 'unreachable' tech requirement seems to be the current best solution though there's still the research object visible from the game. I've tested and it works. However I am still interested in any alternative methods if anyone would have more insight on this topic.
Title: Re: Best way to hide core game objects/items?
Post by: skullywag on August 23, 2017, 05:30:53 PM
umm patch it out using the remove operation....look up patching, plenty of info around the forum.
Title: Re: Best way to hide core game objects/items?
Post by: CannibarRechter on August 23, 2017, 06:12:12 PM
That's totally funny. I mean, I'm using remove myself in other contexts, I just didn't think about it for removing an entire Def. Hmm. Yeah, if that works, that's absolutely the best way (tm).
Title: Re: Best way to hide core game objects/items?
Post by: FauxGrim on August 25, 2017, 12:24:33 PM
Quote from: skullywag on August 23, 2017, 05:30:53 PM
umm patch it out using the remove operation....look up patching, plenty of info around the forum.

It works and is probably the best way to do it when it comes to compatibility and future-proofing the mod itself, but it's not a completely clean solution. In this example I tried Patch-removing the default Bed and SleepingSpot:

(http://i.imgur.com/BXSwnwc.png)

While they are now successfully removed from the game, I'm getting the following errors:

(http://i.imgur.com/Xkaqu0J.png)

I am not yet experienced enough to know if these errors are something that is going to come back and haunt me or something the game can live with. Will continue developing and see how it goes.
Title: Re: Best way to hide core game objects/items?
Post by: jamaicancastle on August 25, 2017, 07:24:32 PM
The InstructionDef those errors are referring to is one of the tutorial instructions that plays, well, during the tutorial. It should be a harmless error if you're not playing the tutorial (although it might or might not be serious if you are), but if you want to get rid of it, find the InstructionDef in Defs/Tutor/Instructions.xml and either remove that instruction entirely, or change the ThingDef entry to refer to your bed replacement.
Title: Re: Best way to hide core game objects/items?
Post by: Ykara on March 31, 2020, 05:45:03 AM
Hello!
Sorry for necroing the thread, but I wondered if there is really no other option to hide a research project without removing it and thus getting red errors?
Title: Re: Best way to hide core game objects/items?
Post by: LWM on March 31, 2020, 11:48:23 AM
You can also search for all <li> elements whose text is the research's defName

Xpath should look something like <xpath>li[text()='defNameOfReserach']</xpath>

I think that's the only way research defs appear in the xml?

Then brutally nuke the InstructionDefs - they should be easier, you can see exactly what they are and no one else is likely to make them.