RimWorld
RimNauts 2
 Ten wątek został przypięty, więc pewnie jest ważny
sindre0830  [producent] 29 października 2022 o 16:57
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>
Ostatnio edytowany przez: sindre0830; 8 lutego 2023 o 8:31
< >
Wyświetlanie 1-15 z 24 komentarzy
pedroface26 3 lutego 2023 o 16:19 
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  [producent] 3 lutego 2023 o 19:32 
@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 5 lutego 2023 o 18:31 
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
Ostatnio edytowany przez: Asierus24; 5 lutego 2023 o 18:33
RimNauts  [producent] 5 lutego 2023 o 22:21 
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 5 lutego 2023 o 23:35 
I wonder if there's a way to add more kinds of moons.
Ostatnio edytowany przez: HRG164hjo; 5 lutego 2023 o 23:40
Asierus24 6 lutego 2023 o 1:40 
will try to make more components and see if it works, if not i will use that mod :) thanks
Asierus24 7 lutego 2023 o 9:23 
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 7 lutego 2023 o 11:18 
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*
Ostatnio edytowany przez: Asierus24; 7 lutego 2023 o 11:25
Asierus24 8 lutego 2023 o 5:38 
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 :)
Ostatnio edytowany przez: Asierus24; 8 lutego 2023 o 6:16
RimNauts  [producent] 8 lutego 2023 o 7:31 
Could you try it in a new save? just use dev mode to spawn everything in.
Asierus24 8 lutego 2023 o 7:37 
same results in new save :(
RimNauts  [producent] 8 lutego 2023 o 7:38 
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 8 lutego 2023 o 7:45 
will try without any other mods and report findings
RimNauts  [producent] 8 lutego 2023 o 7:55 
Had the same issue and the problem lies with the add-on not prefixing the WorldObjectDef defName with "RimNauts2" string.
Ostatnio edytowany przez: RimNauts; 8 lutego 2023 o 8:02
< >
Wyświetlanie 1-15 z 24 komentarzy
Na stronę: 1530 50