RimWorld

RimWorld

Not enough ratings
How to edit the xml in the RRotR mod
By Vampiresbane
A walkthrough on how to edit the xml files of the mod Rails and Roads of the Rim to make changes to roads and rail.
   
Award
Favorite
Favorited
Unfavorite
Introduction

How to Make Pink Railroads
(or how to make changes to the mod RRotR)

I’ll go over how to edit the mod files to your liking in two major parts: RoadDefs and RoadWorldLayerDefs. I will talk you through how the xml files work for RRotR and give an example, using pink rails, on how to change the characteristics.

Keep in mind to make these changes permanent you will need to move this mod folder from “Steam\steamapps\workshop\content\294100” to “Steam\steamapps\common\RimWorld\Mods”. If you just want to test things out and then go back to the original, you can unsubscribe and subscribe in the Steam workshop. Also keep in mind that I learned all this by trial and error; there are some assumptions I’m making that may not be correct.

There’s quite a few def files that can be changed but for this guide, we’re going to focus on just two: RoadDefs and RoadWorldLayerDefs.

Both of these def files can be found in:
Modfolder/1.3/Defs/RoadDefs
RoadDefs
RoadDefs controls the width of your buildable road or rail, their layers (more on that later), what resources are required to build then, and research required among other parameters. Also you may have figured this out already, but because of how I added buildable rail, Rimworld considers them “roads” so from this point forward if I say road, I mean both buildable roads and buildable rail.


As far as I can tell the widest a piece of road can be is ~1.5, maybe 1.2. Each road piece takes up a portion of a hexagon on the world map. I don’t believe you can make road sections larger than the hexagons. Typically for generated roads to display a layer correctly, you need the thickness difference between layers to be at least 0.05 (0.025 on either side), but that’s really thin. I generally used at least 0.10 for the rail types I coded (0.05 on either side).

For movement, the road bonus is a % of what speed a caravan would normally move at on the world map based on world terrain, biome, and weather as well as pawns, ridable animals and if the caravan is carrying less than its maximum load. Nekko’s glitteroad, for instance, has a % movement of 25%. All my added rails have a 60% movement of for reasons explained on the main mod page. Note that base world movement speed is (“1 movement difficulty”) 0.06 days/hexagon for base human speed (Caravan: Rimworld wiki[rimworldwiki.com]).

Tech require and research required are somewhat self-explanatory. We are not changing these in this guide but tech includes Medieval, Industrial, and Spacer while the research project is what is named and defined in the “ResearchProject” file.

Resources is what is required to construct the road. My personal opinion is that the 10% setting is “realistic” for the resources RRotR requires for each road. I base this off on how many resources are needed to build 4 sections of road using 5 pawns and 6 elephants to transport food and building materials. That amounts to ~205 total resources per unit road built (for the 100% setting this is 2,050/unit road built which is quite heavy).

Lastly, if you want a certain type of road to bulldoze any previously built road, as it builds over the top, type “Bulldoze”. Otherwise, type “Avoid”.
RoadWorldLayerDefs
Now for the world defs. RoadWorldLayerDefs matters for three main reasons:
1. Naming new “layers”
2. Assigning color to that layer.
3. Assigning a height or “order” to that layer.

For #1, there is a character limit. I think* it’s 20 characters or less, but I’m not positive. I know I had a layer with a really long name and it didn’t work. Otherwise name it whatever you want but something you can remember.

For #2, use this site (https://html-color.codes/) and stick to very basic colors. The game engine (or my eyes) does not do a good job of showing the difference between “Grey” and “Slate Grey” for example. If we want pink it’s listed as (255,192,203), but we need to change this to something that the game can read. So 255/256, 192/256, 203/256 ->(1, 0.7, 0.8).

For #3, the top layers need the largest number so they are layered last (on “top”). So looking at “railroad” we see it’s:
Pink Rail time
Ah now…to make our eyes bleed to make glorious pink rail. How about pink sleepers with red rail? And let’s make everything larger.

(Btw many of you readers have probably wondered why no “horizontal” wood sleepers? Well, either because of my limited coding ability or because of how the game engine generates roads, all lines are “vertical”. So sadly we cannot distinguish between the tan/brown sleepers and the grey gravel/ballast between. Just assume you’re looking at the laid rail from high enough it blurs together. Least that’s what I tell myself so I can sleep at night. 😊 Or if you figure it out, send me the code!)

Let’s change the RoadDef widths to:
<li>
<layer>Gravel</layer>
<width>0.7</width>
</li>
<li>
<layer>Outtersleepers</layer>
<width>0.5</width>
</li>
<li>
<layer>Rail</layer>
<width>0.35</width>
</li>
<li>
<layer>Innersleepers</layer>
<width>0.2</width>
</li>

Let’s change the colors for Outtersleepers, Rail, and Innersleepers respectively to (1.0, 0.7, 0.8), (1.0,0,0), and (1.0, 0.7, 0.8).

Now let’s test it in game.

Voila!
Goodness my eyes but there is wide pink railroad for you. Don’t blame me-the editors chose the color. Just kidding. I randomly picked a weird color for demonstration’s sake. Feel free to try this out with any colors you want to get a feel for it.

Hopefully that helps and gives you all enough to tinker with RRotR base xml code. Feel free—I really do not mind.
How to Add ISR2G and AISR2G to RRotR
When I added rails to RotR to make RRotR, I also took out the option to use Neko's "In Situ Road Resource Gatherer" (ISR2G) and the "Advanced In Situ Road Resource Gatherer". I did this for a number of reasons. First and foremost, the resource gatherers created a lot of bug issues that I wanted to avoid. Second, they were difficult to use as a player when building roads over difficult terrain like mountains or swamps.

However, many players keep asking for them to be added back in. While I won't be doing that myself, I'm going to tell you how you can do it yourself. But be warned. This is a user beware and use at your own risk option.

How did I remove them in first place? I simply made ISR2G and AISR2G impossible to research. To fix that, all you have to do is edit the "ResearchProject_RotR" file in 1.3/Defs or 1.4/Defs or "yourversion_here/Defs".

Copy/paste the following into that file at the very end, but right before "</Defs>":
<ResearchProjectDef>
<defName>ResearchProject_RotRISR2G</defName>
<label>ISR2G</label>
<description>Allows construction of the In Situ Road Resource Gatherer (ISR2G). Uses local resources when building roads, completely eliminating the need to bring wood and stone at the cost of 4 times the work.</description>
<baseCost>2000</baseCost>
<techLevel>Industrial</techLevel>
<prerequisites>
<li>ResearchProject_RotRStoneRoad</li>
</prerequisites>
<tab>LocoNekoMods</tab>
<researchViewX>2</researchViewX>
<researchViewY>1</researchViewY>
</ResearchProjectDef>
<ResearchProjectDef>
<defName>ResearchProject_RotRAISR2G</defName>
<label>AISR2G</label>
<description>Allows construction of the Advanced In Situ Road Resource Gatherer (AISR2G). Uses local resources when building roads, completely eliminating the need to bring wood, stone , steel, Chemfuel , Plasteel and Uranium at the cost of twice the work.</description>
<baseCost>4000</baseCost>
<techLevel>Spacer</techLevel>
<requiredResearchBuilding>HiTechResearchBench</requiredResearchBuilding>
<prerequisites>
<li>ResearchProject_RotRAsphaltRoad</li>
</prerequisites>
<tab>LocoNekoMods</tab>
<researchViewX>3</researchViewX>
<researchViewY>1</researchViewY>
</ResearchProjectDef>

The whole xml code should be organized like this:

<?xml version="1.0" encoding="utf-8"?>
<Defs>
...xml code...
</Defs>

Thanks to Ombrero for helping me realize I also had removed a folder and xml file inside that allows for ISR2G use. However, due to character limit in steam guides, I unfortunately have to post this here in pictures so it'll be a little painful copy/pasting it from here.

In addition to making changes to the research xml, you'll want to make a new folder called "ThingDefs" inside of the (version #)/Defs/ folder. So that'll be <modname>/1.3/Defs or <modname>/1.4/Defs. Once you have a ThingsDefs folder. Either make a new xml file inside of it or copy paste one from a different folder to keep the formating. Rename it/name it "RotR_Buildings".

In the new RotR_Buildings xml file, (delete any old xml code) then put the below xml code:


You also need to add back the textures for the ISR2G's. Take the "Building" folder from this github link[github.com]. Then copy/paste those files in the RRotR/Texures folder.

Alternatively, you can copy/paste the code from the original mod file here on Github[github.com], but it may not stay there forever.

IF all of this worked, you should be able to build either ISRG at a machining table.