As most modders have figured out I imagine a lot of things have moved around in the source files. However, this table this is new to me. I am not sure if it is exclusive to 1.5 or was present in earlier versions between 1.08 and 1.5
The normal ore tables for the ore type asteroids, such as &tbVolcanicAsteroidOre, are now in the UniversalCompatibility.xml instead of the Mining.xml file.
However, the &tbAsteroidOre; table is in the Mining.xml and this table is very different and I am really not sure of the function.
Code: Select all
<ItemTable unid="&tbVolcanicAsteroidOre;">
<LevelTable>
<Item levelFrequency="vrucc ccccc ccccc ccccc ccccc" count="5-10" item="&itGoldOre;"/>
<Item levelFrequency="vrucc ccccc ccccc ccccc ccccc" count="1-35" item="&itXenotiteOre;"/>
<Item levelFrequency="--vru uuuuu uuuuu uuuuu uuuuu" count="5-10" item="&itDuralloyOre;"/>
<Item levelFrequency="--vru uuuuu uuuuu uuuuu uuuuu" count="1-10" item="&itPlatinumOre;"/>
<Item levelFrequency="--vru uuuuu uuuuu uuuuu uuuuu" count="5-25" item="&itPteracniumOre;"/>
<Item levelFrequency="---ru ccccc ccccc ccccc ccccc" count="10-45" item="&itOrthoSteelOre;"/>
<Item levelFrequency="----v ruuuu uuuuu uuuuu uuuuu" count="1-10" item="&itIthaliumOre;"/>
<Item levelFrequency="----- -vvvv vvvvv vvvvv vvvvv" count="10-35" item="&itIthaliumOre;"/>
<Item levelFrequency="----- --vrr rrrrr rrrrr rrrrr" count="1-4" item="&itNeutroniumOre;"/>
<Item levelFrequency="----- --vrr rrrrr rrrrr rrrrr" count="1-6" item="&itTetramiteOre;"/>
<Item levelFrequency="----- ---vr rrrrr rrrrr rrrrr" count="1-2" item="&itHyperonicOre;"/>
<Item levelFrequency="----- ---vr rrrrr rrrrr rrrrr" count="1" item="&itEtheriumOre;"/>
</LevelTable>
</ItemTable>
Code: Select all
<ItemTable unid="&tbAsteroidOre;">
<LocationCriteriaTable>
<Group criteria="*metallicComp"
levelValue="
100, 160, 250, 500, 1000,
2000, 4000, 8000, 16000, 32000,
64000, 128000, 256000, 512000, 1000000,
2000000, 4100000, 8200000, 16400000, 32800000"
>
<RandomItem criteria="* +ore; -notStandard; +metallicComp;" levelFrequency="systemLevel:vruuc|c|cuurv" />
</Group>
<Group criteria="*organicComp"
levelValue="
100, 160, 250, 500, 1000,
2000, 4000, 8000, 16000, 32000,
64000, 128000, 256000, 512000, 1000000,
2000000, 4100000, 8200000, 16400000, 32800000"
>
<RandomItem criteria="* +ore; -notStandard; +organicComp;" levelFrequency="systemLevel:vruuc|c|cuurv" />
</Group>
<Group criteria="*rockyComp"
levelValue="
100, 160, 250, 500, 1000,
2000, 4000, 8000, 16000, 32000,
64000, 128000, 256000, 512000, 1000000,
2000000, 4100000, 8200000, 16400000, 32800000"
>
<RandomItem criteria="* +ore; -notStandard; +rockyComp;" levelFrequency="systemLevel:vruuc|c|cuurv" />
</Group>
<Group criteria="*waterComp"
levelValue="
100, 160, 250, 500, 1000,
2000, 4000, 8000, 16000, 32000,
64000, 128000, 256000, 512000, 1000000,
2000000, 4100000, 8200000, 16400000, 32800000"
>
<RandomItem criteria="* +ore; -notStandard; +waterComp;" levelFrequency="systemLevel:vruuc|c|cuurv" />
</Group>
</LocationCriteriaTable>
</ItemTable>
(sysAddRandomOreByValue ...)
(sysGetRandomOreType ...)
Code: Select all
(setq sysAddRandomOreByValue (lambda (destObj value)
(block (
(loops 20)
(valuePerLoop (divide value loops))
)
(for i 1 loops
(objAddItemByValue destObj (itmCreate (sysGetRandomOreType) 1) valuePerLoop 'credit)
)
)
))
Code: Select all
(setq sysGetRandomOreType (lambda ()
; Returns a random ore type appropriate to the system. This function
; computes the probability of any one ore type appearing in the
; system based on the distribution of ore items in asteroids.
; ------------------------------------------------------------------
(block (oreTable)
; Generate a probability table from the ore-bearing
; asteroids in the system. The probability table is a list
; of entries. Each entry is a probability followed by an
; ore type. The first entry has Nil followed by the total
; probability count.
(setq oreTable (sysGetData "08040003_oreTable"))
(if (not oreTable)
(block (tempTable totalProb)
(setq tempTable {})
; Generate a symbol table keyed by ore type storing
; the amount of ore found for each ore type.
(enum (sysFindObject Nil "t +asteroid") theObj
(enum (objGetItems theObj "t +Ore;") theOre
(block (currentAmount)
(setq currentAmount (item tempTable (itmGetType theOre)))
(if (not currentAmount)
(setq currentAmount (itmGetCount theOre))
(setq currentAmount (add currentAmount (itmGetCount theOre)))
)
(setItem tempTable (itmGetType theOre) currentAmount)
)
)
)
; If the probability table is empty, then it means
; that there is no ore in the system. Instead we
; enumerate all types and generate probabilities
; based on the frequency of the ore at this level.
(if (eq (count tempTable) 0)
(enum (itmGetTypes "t +Ore;") theOreType
(block (freq)
(setq freq (itmGetFrequency theOreType (sysGetLevel)))
(if (gr freq 0)
(setItem tempTable theOreType (itmGetFrequency theOreType (sysGetLevel)))
)
)
)
)
; Add the total probability
(setq totalProb 0)
(enum tempTable theEntry
(setq totalProb (add totalProb (item theEntry 1)))
)
; Generate a probability table
(setq oreTable
(append
(list (list totalProb Nil))
(map tempTable theEntry
(list (item theEntry 1) (int (item theEntry 0)))
)
)
)
(sysSetData "08040003_oreTable" oreTable)
)
)
(mathProbTableLookup oreTable)
)
))