RimWorld

RimWorld

RimNauts 2
 This topic has been pinned, so it's probably important
sindre0830  [developer] Oct 29, 2022 @ 4:57pm
Modding: Adding custom mineral-rich asteroids
We have made it as easy as possible to add mineral-rich asteroids through XML.

Example

Genstep is where you add the values such as mineral type. The ore_chance_outer/inner fields are written as a 2D vector and a random value between the two will be chosen.
<GenStepDef> <defName>RimNauts2_OreSteel_GenStep_RocksFromGrid</defName> <order>10</order> <genStep Class="RimNauts2.AsteroidOre.RocksFromGrid"> <!-- asteroid rock type --> <rock_def_name>Limestone</rock_def_name> <!-- mineral type --> <ore_def_name>MineableSteel</ore_def_name> <!-- chance of mineral to spawn on the outer side of the asteroid --> <ore_chance_outer>(0.30, 0.50)</ore_chance_outer> <!-- chance of mineral to spawn inside the asteroid --> <ore_chance_inner>(0.50, 0.70)</ore_chance_inner> </genStep> </GenStepDef>

MapGenerator is very simple and only requires the genstep def_name that was created above.
<MapGeneratorDef ParentName="RimNauts2_Ore_MapGen"> <defName>RimNauts2_OreSteel_MapGen</defName> <genSteps> <li>RimNauts2_OreSteel_GenStep_RocksFromGrid</li> </genSteps> </MapGeneratorDef>

WorldObejct is what is spawned on the world map and keeps the def_name of the mapgenerator that you created before.
It is important to add RimNauts2 in the defName as the mod checks if RimNauts2 exists in the WorldObjectDef defName for some functions.
Note: this is also where you add the path to your texture.
<WorldObjectDef ParentName="RimNauts2_Ore"> <defName>RimNauts2_OreSteel_1</defName> <label>steel ore asteroid</label> <description>An asteroid rich with minerals.</description> <texture>Satellites/Ores/RimNauts2_OreSteel_1</texture> <expandingIconTexture> Satellites/Ores/RimNauts2_OreSteel_1 </expandingIconTexture> <mapGenerator>RimNauts2_OreSteel_MapGen</mapGenerator> </WorldObjectDef>

This patch is needed to add the new asteroid that you created to the pool of possible asteroids to spawn.
<Operation Class="PatchOperationAdd"> <xpath> Defs/RimNauts2.SatelliteDef[defName="Satellite"]/AsteroidOreObjects </xpath> <value> <li>RimNauts2_OreSteel_1</li> </value> </Operation>
Last edited by sindre0830; Feb 8, 2023 @ 8:31am
< >
Showing 1-15 of 24 comments
pedroface26 Feb 3, 2023 @ 4:19pm 
I have 0 experience with modding, but would like to generate silver asteroids using this code. Is there a guide I can use on how to implement this into the mod?
twsta  [developer] Feb 3, 2023 @ 7:32pm 
@pedroface26 you could make your own mod add-on to Rimnauts 2 very easily to do this.

Join the Discord and msg me, I can walk you through the process if you like. It is very easy to do.
Asierus24 Feb 5, 2023 @ 6:31pm 
already did a component asteroid for my playtrough as i have some mods that are heavy on components usage, but can't manage to get them spawn , i tried using the dev mode to convert all the asteroid field to ores and no custom asteroid appeared :(



code for the asteroid in question:

MapGenerator:

<MapGeneratorDef ParentName="RimNauts2_Ore_MapGen"> <defName>RimNauts2_Orecomponent_MapGen</defName> <genSteps> <li>RimNauts2_Orecomponent_GenStep_RocksFromGrid</li> </genSteps> </MapGeneratorDef>

Genstep:

<GenStepDef> <defName>RimNauts2_Orecomponent_GenStep_RocksFromGrid</defName> <order>10</order> <genStep Class="RimNauts2.AsteroidOre.RocksFromGrid"> <rock_def_name>Limestone</rock_def_name> <ore_def_name>MineableComponentsIndustrial</ore_def_name> <ore_chance_outer>(0.20, 0.30)</ore_chance_outer> <ore_chance_inner>(0.30, 0.50)</ore_chance_inner> </genStep> </GenStepDef>

WorldObject:

<WorldObjectDef ParentName="RimNauts2_Ore"> <defName>RimNauts2_Orecomponent_1</defName> <label>Compacted machinery asteroid</label> <description>An asteroid that has old chunks of machinery on it, probably ancient mining operation machines or ships that collided with the asteroid.</description> <texture>Satellites/Ores/RimNauts2_Orecomponent_1</texture> <expandingIconTexture>Satellites/Ores/RimNauts2_Orecomponent_1</expandingIconTexture> <mapGenerator>RimNauts2_Orecomponent_MapGen</mapGenerator> </WorldObjectDef>
(made texture for it)


patch:

<Patch> <Operation Class="PatchOperationAdd"> <xpath>Defs/RimNauts2.SatelliteDef[defName="Satellite"]/AsteroidOreObjects</xpath> <value> <li>RimNauts2_Orecomponent_1</li> </value> </Operation> </Patch>
any help is appreciated
Last edited by Asierus24; Feb 5, 2023 @ 6:33pm
RimNauts  [developer] Feb 5, 2023 @ 10:21pm 
Not sure why that doesn't work, the chance of it spawning is dependent on the number of component ores added to the patch so you might just be unlucky. Here is another mod that has added components and other ores as asteroids https://steamcommunity.com/sharedfiles/filedetails/?id=2928024816
HRG164hjo Feb 5, 2023 @ 11:35pm 
I wonder if there's a way to add more kinds of moons.
Last edited by HRG164hjo; Feb 5, 2023 @ 11:40pm
Asierus24 Feb 6, 2023 @ 1:40am 
will try to make more components and see if it works, if not i will use that mod :) thanks
Asierus24 Feb 7, 2023 @ 9:23am 
i got the out of range msg when trying to get into an asteroid from this mod (More Asteroids For RimNauts 2 ) also tried to go from a nearby asteroid that i can reach on full fuel (cargo rocket) also tried from my colony on the planet and from a launch pad i made on one of the moons, cant reach by any means provided by Rimnauts. i added the mod on a running save this may be an issue? all attemps were made with full fuel loaded.
Asierus24 Feb 7, 2023 @ 11:18am 
uhmm still getting the out of range :( even reloading the game after, i can only reach steel,plasteel,uranium and gold but cant reach components,jade and silver ones *regenerated 500 objects*
Last edited by Asierus24; Feb 7, 2023 @ 11:25am
Asierus24 Feb 8, 2023 @ 5:38am 
the only way to reach them is with the SRTS genesis as they require over 40k chemfuel to reach when an nearby steel asteroid uses 300 or less, weird :)
Last edited by Asierus24; Feb 8, 2023 @ 6:16am
RimNauts  [developer] Feb 8, 2023 @ 7:31am 
Could you try it in a new save? just use dev mode to spawn everything in.
Asierus24 Feb 8, 2023 @ 7:37am 
same results in new save :(
RimNauts  [developer] Feb 8, 2023 @ 7:38am 
I will test it out myself, but it sounds like you have a mod conflict that overwrites the transport distance patch implemented from this mod
Asierus24 Feb 8, 2023 @ 7:45am 
will try without any other mods and report findings
RimNauts  [developer] Feb 8, 2023 @ 7:55am 
Had the same issue and the problem lies with the add-on not prefixing the WorldObjectDef defName with "RimNauts2" string.
Last edited by RimNauts; Feb 8, 2023 @ 8:02am
< >
Showing 1-15 of 24 comments
Per page: 1530 50