How to change ore drops from veins?

Started by Nekomimi, May 22, 2015, 08:46:40 AM

Previous topic - Next topic

Nekomimi

As in title. For example, to make Compacted Steel drop 50 instead of 35. Or to make Compacted Plasteel drop Chocolate.
Have you fell here from the sky
Have you been trapped under stone
We're all glad that you survive
This is now your only home

Born in the primitive tribe
Joined the pirates in their cove
The past doesn't matter now
The Vault Seven is your home

Shinzy

Quote from: Nekomimi on May 22, 2015, 08:46:40 AM
As in title. For example, to make Compacted Steel drop 50 instead of 35. Or to make Compacted Plasteel drop Chocolate.

In Core/Defs/ThingDefs/Buildings_natural.xml
you can find the mineable ore chunks and change the yield and whatever's being mined from it, including chocolate! ;D

Nekomimi

Thank you.

If I add another "  <ThingDef ParentName="RockBase">" It will make another rock that will naturally generate? Trying to make "Unrefined" Steel in addition to current core one, and it would be good idea to add small (like silver) chance for pure steel.

Got another question, but will ask it later... If I don't solve it myself by reverse engineering of mods.
Have you fell here from the sky
Have you been trapped under stone
We're all glad that you survive
This is now your only home

Born in the primitive tribe
Joined the pirates in their cove
The past doesn't matter now
The Vault Seven is your home

Shinzy

Quote from: Nekomimi on May 22, 2015, 10:15:51 AM
Thank you.

If I add another "  <ThingDef ParentName="RockBase">" It will make another rock that will naturally generate? Trying to make "Unrefined" Steel in addition to current core one, and it would be good idea to add small (like silver) chance for pure steel.

Got another question, but will ask it later... If I don't solve it myself by reverse engineering of mods.

from what I remember what our beloved moderator cat ItchyFlea posted in the ages past that just making new
thing didn't automatically generate on the map
but something may have changed since and so it's worth to try! ;D
I've never touched the map gen stuffs or those, so when you run into trouble you best make new thread about it so the experienced ones can spot it!

Nekomimi

If nothing works, I can just get rid of gold.

To be honest, value of unrefined steel should be one of normal steel atm, and normal steel should be bumped up a bit... so economy should remain at same ratio.
Have you fell here from the sky
Have you been trapped under stone
We're all glad that you survive
This is now your only home

Born in the primitive tribe
Joined the pirates in their cove
The past doesn't matter now
The Vault Seven is your home

soltysek

It will generate custom ore as long as is define same as vanila in my mod i alter vanila (null) and add my one with diferend defName ang thingClass more over i made custom class for each one to drop random amount with researches that modifi amount min/max and chance fo beter drop and higher chance for extra drop :) its SUPPPPER easy

1000101

#6
You need two basic things to create new mineable resource which will auto-gen (requires a new world).

Look at the existing xml defs for "RockBase" and it's derived objects (such as Granite).  They define the rock for the maps.  The other thing you need is something to mine which, for the core rocks, is "chunks."  Metals work almost identically and you will see how pretty quick.

Within a few hours I was able to create an aluminium production chain by mining bauxite rock into bauxite chunks which get turned into alumina at the stone cutting workbench and smelted with "industrial chemicals" (made at another workbench) to produce aluminium.  Not sure if I will make anything of it, it was just an personal challenge to figure out the systems involved and increasing levels of complexity.

xml to create mineable bauxite rock:
/Mods/modName/Defs/ThingDefs/Bauxite.xml
<?xml version="1.0" encoding="UTF-8"?>
<Defs>
<!--======================= Bases ==============================-->
<ThingDef Name="ResourceBase" Abstract="True">
<thingClass>ThingWithComps</thingClass>
<label>unspecified resource</label>
<category>Item</category>
<resourceReadoutPriority>Middle</resourceReadoutPriority>
<useHitPoints>true</useHitPoints>
<selectable>true</selectable>
<altitudeLayer>Item</altitudeLayer>
<stackLimit>75</stackLimit>
<comps>
<li>
<compClass>CompForbiddable</compClass>
</li>
</comps>
<alwaysHaulable>true</alwaysHaulable>
<drawGUIOverlay>true</drawGUIOverlay>
<rotatable>false</rotatable>
<pathCost>15</pathCost>
</ThingDef>
<!--======================= Natural Building Base ==============================-->
<ThingDef Name="BuildingNaturalBase" Abstract="True">
<category>Building</category>
<selectable>true</selectable>
<drawerType>MapMeshOnly</drawerType>
</ThingDef>
<!--======================= Natural Rock Base ==============================-->
<ThingDef Name="RockBase" ParentName="BuildingNaturalBase" Abstract="True">
<thingClass>Mineable</thingClass>
<graphicPath>Things/Building/Linked/Rock_Atlas</graphicPath>
<graphicClass>Graphic_Single</graphicClass>
<linkDrawerType>CornerFiller</linkDrawerType>
<altitudeLayer>BuildingTall</altitudeLayer>
<passability>Impassable</passability>
<castEdgeShadows>true</castEdgeShadows>
<fillPercent>1</fillPercent>
<coversFloor>true</coversFloor>
<neverMultiSelect>true</neverMultiSelect>
<rotatable>false</rotatable>
<saveCompressible>true</saveCompressible>
<filthLeaving>RockRubble</filthLeaving>
<holdsRoof>true</holdsRoof>
<staticSunShadowHeight>1.0</staticSunShadowHeight>
<blockLight>true</blockLight>
<mineable>true</mineable>
<statBases>
<Flammability>0</Flammability>
<Beauty>-2</Beauty>
</statBases>
<building>
<isInert>true</isInert>
<isNaturalRock>true</isNaturalRock>
<soundMined>CollapseRock</soundMined>
<canBuildNonEdificesUnder>false</canBuildNonEdificesUnder>
</building>
<linkFlags>
<li>Rock</li>
<li>MapEdge</li>
</linkFlags>
</ThingDef>
<!--======================= Chunk Base ==============================-->
<ThingDef Name="ChunkBase" Abstract="True">
<category>Item</category>
<thingClass>Thing</thingClass>
<altitudeLayer>Item</altitudeLayer>
<passability>PassThroughOnly</passability>
<fillPercent>0.4</fillPercent>
<statBases>
<MaxHitPoints>300</MaxHitPoints>
<Flammability>0</Flammability>
<Beauty>-10</Beauty>
</statBases>
<selectable>true</selectable>
<neverMultiSelect>true</neverMultiSelect>
<pathCost>55</pathCost>
<graphicOverdraw>false</graphicOverdraw>
<drawerType>MapMeshOnly</drawerType>
<randomizeRotationOnSpawn>true</randomizeRotationOnSpawn>
<designateHaulable>true</designateHaulable>
<saveCompressible>true</saveCompressible>
<stackLimit>1</stackLimit>
<tradeability>Never</tradeability>
</ThingDef>
<!--======================= Bauxite Rock ==============================-->
<ThingDef ParentName="RockBase">
<defName>Bauxite</defName>
<label>bauxite</label>
<description>Bauxite, an aluminium ore, is the world's main source of aluminium.</description>
<defaultColor>(169,131,120)</defaultColor>
<statBases>
<MaxHitPoints>1000</MaxHitPoints>
</statBases>
<building>
<mineableThing>ChunkBauxite</mineableThing>
<mineableDropChance>1</mineableDropChance>
</building>
</ThingDef>
<!--======================= Bauxite Chunk ==============================-->
<ThingDef ParentName="ChunkBase">
<defName>ChunkBauxite</defName>
<label>bauxite chunk</label>
<graphicPath>Things/Item/Chunk/ChunkStone</graphicPath>
<graphicClass>Graphic_Random</graphicClass>
<soundDrop>ChunkRock_Drop</soundDrop>
<defaultColor>(169,131,120)</defaultColor>
<thingCategories>
<li>StoneChunks</li>
</thingCategories>
</ThingDef>
</Defs>
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

1000101

Not sure if you figured metals out yet, but here's some more info.

Metals also use a RockBase to control map distribution.  Unlike regular rocks however, they use the scatteribility tags to control how large and how frequent they show up.

The bauxite example above will create bauxite like a regular rock which will have a large map-wide distribution and may or may not show up on an individual map.  To change it to a per-map deposit similar to the metals, a couple lines of code need to be added to the building tag section of the rock def.

The current bauxite example shows this for the building section of "Bauxite":
<building>
<mineableThing>ChunkBauxite</mineableThing>
<mineableDropChance>1</mineableDropChance>
</building>


To make it a individual deposits instead walls of rock, we'll change that to this:
<building>
<isResourceRock>true</isResourceRock>
<mineableThing>BauxiteChunk</mineableThing>
<mineableYield>1</mineableYield>
<mineableScatterCommonality>0.5</mineableScatterCommonality>
<mineableScatterBlotchSizeRange>
<min>20</min>
<max>40</max>
</mineableScatterBlotchSizeRange>
</building>


By changing that, you go from map-wide rock formations of bauxite to individual deposits like steel and plasteel.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By