Correctly replacing plant and immature plant textures

Started by Syrchalis, July 10, 2018, 08:04:49 AM

Previous topic - Next topic

Syrchalis

Original Question (new question at the bottom):
I've written a very long file with tons of patches to modify vanilla defs in a way I like, because I can't be bothered to do all of it again whenever I re-install Rimworld or a new version overwrites my changes.

Mostly I was able to teach myself how to write the xml patch operations so they work without problems. One thing is making me wonder though. Why does this not work:
<Operation Class="PatchOperationReplace">
<xpath>*/ThingDef[defName = "TreeBase"]/plant/sowWork</xpath>
<value>
<sowWork>4000</sowWork>
</value>
</Operation>


I copied the defname and nodes from the original def, so no spelling errors. Similar operations work without problems. Does it have to do with it being a parent? Or being abstract?
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

AileTheAlien

It seems like the def you're looking for must have changed since you wrote that xpath. If you look at the def for TreeBase now, it starts with:
<ThingDef ParentName="PlantBase" Name="TreeBase" Abstract="True">

and it doesn't have any <defName> tag, later on in its definition. So, you'd want to select by <xpath>/Defs/ThingDef[@Name="TreeBase"]/plant/sowWork</xpath>
Note the @ symbol, for selecting by attribute; I had to learn the same thing last week.

Syrchalis

Ah that explains it. Thanks.

Another question I had was this:
I have a custom pattern for a wall. The game has planks and bricks and it's really easy to add those to the material. If I want to define/add a new pattern and I have the textures already, how would I do that?
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

AileTheAlien

Looks like it's pretty easy to subclass, for different costs of stone / carpet tiles:
Core/Defs/TerrainDefs/Terrain_Floors_StoneTile.xml

For walls, it's also relatively easy-looking, although set up with stuff categories for ingredients, rather than specific recipes per wall type:
Defs/ThingDefs_Buildings/Buildings_Structure.xml

Syrchalis

#4
Oh, I think you misunderstood, I'm not looking to add another material to walls, but I'm looking to add another appearance to them:
\Defs\Misc\StuffAppearanceDefs.xml

Adding another StuffApperanceDef is of course super easy, but that wouldn't define it. The game has to know what my new def means. Somewhere the pattern has to be defined but I see no texture path or similar.

<stuffProps>
<appearance>Bricks</appearance>
</stuffProps>

That's how it's added to a thingdef, as example are bricks like for marble/slate/other stony walls.
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Shinzy

after linking the appearance def with the stuff
you need an wall atlas named "Wall_Atlas_Bricks" changing the bricks to whatever your stuff is named

and find out the texture path for vanilla wall and then replicate that same exact path within your mod and plop the texture there. That should do it in theory

Syrchalis

#6
Well so far so good, I have the Wall_Atlas_*, but I have no idea how I would find the texture path for vanilla. I know the general idea of the folder structure. "Things/Building/Linked/Wall" for example is the wall texture. I searched the entire core folder for "Wall_Atlas" and "Atlas" but I didn't find these patterns. (By searched I mean I let a program run through the XML files, not windows search (lol)). So if it had been referenced anywhere I would have found it.

Edit: Okay it seems to be just "Things/Building/Linked/Wall" and if you throw it in there it works. If now my asset wasn't garbage... meh you have to do everything yourself. The pattern doesn't align, so I have to redo the graphic.

Edit 2: Done, looks good.


[attachment deleted due to age]
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.

Syrchalis

#7
New issue: I was trying to replace the graphic of some plants (corn, cotton, devilstrand, rice, healroot) and add an immature graphic to those that don't already have one (plus overwrite existing ones - like corn/cotton). However I don't seem to be able to make the correct folder structure or name the files correctly as they do not get overwritten correctly.

Note: This is for 1.0.
For mod support visit the steam pages of my mods, Github or if necessary, write me a PM on Discord. Usually you will find the best help in #troubleshooting in the RimWorld discord.