[MOD] (Alpha 7) Mineable ores utility mod

Started by Duncan, October 03, 2014, 07:53:53 AM

Previous topic - Next topic

Duncan

Hi all, I was helping ItchyFlea with his Neolithic Mod and I built a system to make the game accept modded ores. I thought this could interest other modders too so I am posting it here.

This mod is designed for inclusion in other mods, not as a standalone mod. Do not simply install it in your game or you will get silly bright coloured minerals that drop AI cores, and no metal.

You can download it here.

Usage:

Copy the MineableMod.dll in the assembly folder and the ModMapGenerators.xml for the MapGeneratorDefs.

If you are using an already modded MapGenerator you can just change the part where it says:
<!-- Create rocks from Elevation grid -->
      <li Class="Genstep_RocksFromGrid" />


to
<!-- Create rocks from Elevation grid -->
      <li Class="MineableMod.Genstep_RocksFromGrid_Mod" />


This is the part that calls my custom mineable scatterer.

Each modded ore needs to have a <fillPercent></fillPercent> tag with the probability of it spawning. These numbers are relative, see notes below for details or just treat them as an actual percentage, which will work as expected.

This mod will not add any vanilla ores to the map unless there are no custom ones defined. If you want vanilla ores you will have to add Defs for them copied from core and give them an appropriate fillpercent.

Notes:
The tag fillPercent is an internal rimworld tag that is used to define cover effectiveness. 1 is 100% cover (bullets dont go through stone) so using values lower than 1 is not recommended.

fillPercent is normalised internally in my code so your ores don't have to add up to 100%. If you have 2 ores with 1000% each it will work out the same as if you have two ores with 50% each, the percentages are actually just relative float values. This is also not extensively tested so let me know if this causes problems.

The actual total amount of ore per map is still the same as vanilla. I could modify this easily enough but it might be difficult to make it xml moddable. If someone desperately needs a mod with half as much or twice as much ore per map I could probably make that happen.

License is CC/BY


Rikiki

fillPercent is used during projectile flying calculation. It helps to determine weather a bullet should be stoppped by a cover.

You may instead add some custom XML variable for this percentage. You may look into the atomic power mod which has some:
http://ludeon.com/forums/index.php?topic=2299.0

Good job anyway! :)

Duncan

Quote from: Rikiki on October 03, 2014, 08:37:21 AM
fillPercent is used during projectile flying calculation. It helps to determine weather a bullet should be stoppped by a cover.

That can't be right, all rock types have fillPercent 1. Or is that a 0-1 float?

ItchyFlea

This appears to completely remove the game's default ores, but they would take about a minute to re-add to the game, so no harm done. :)
I also know of at least one other modder who would definitely like this.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Rikiki

If you look in the core code, all chances are float values [0; 1]. So yes, it is normal that rock chunk have a fill percent of 1 => this is a good cover and bullet have high chance to be stopped by it.

Duncan

I updated the OP regarding fillpercent, it should be fine but if people have issues with it I will implement a variable for it properly.

Cala13er

Quote from: ItchyFlea on October 03, 2014, 04:29:58 PM
This appears to completely remove the game's default ores, but they would take about a minute to re-add to the game, so no harm done. :)
I also know of at least one other modder who would definitely like this.

That me by any chance?

ItchyFlea

All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created