User:DeepCherry

From Vintage Story Wiki

The following code is from vssurvivalmod/Systems/Prospecting/ItemPorspectingPick.cs

                ppws.depositsByCode[val.Key].GetPropickReading(pos, oreDist, blockColumn, out ppt, out totalFactor);

                if (totalFactor > 0)
                {
                    var reading = new OreReading();
                    reading.TotalFactor = totalFactor;
                    reading.PartsPerThousand = ppt;
                    readings.OreReadings[val.Key] = reading;
                }

This code comes from vssurvivalmod/Systems/WorldGen/Standard/ChunkGen/5.GenDeposits/Generators/DiscGenerator.cs

        public override void GetPropickReading(BlockPos pos, int oreDist, int[] blockColumn, out double ppt, out double totalFactor)
        {
            int mapheight = Api.World.BlockAccessor.GetTerrainMapheightAt(pos);
            int qchunkblocks = mapheight * chunksize * chunksize;

            double oreMapFactor = (oreDist & 0xff) / 255.0;
            double rockFactor = oreBearingBlockQuantityRelative(pos, variant.Code, blockColumn);
            totalFactor = oreMapFactor * rockFactor;

            double quantityOres = totalFactor * absAvgQuantity;

            double relq = quantityOres / qchunkblocks;
            ppt = relq * 1000;
        }

Additionally, I find the comments in this snippet (vssurvivalmod/Systems/WorldGen/Standard/ChunkGen/5.GenDeposits/DepositGeneratorBase.cs) to be illucidating:

        public abstract void GetPropickReading(BlockPos pos, int oreDist, int[] blockColumn, out double ppt, out double totalFactor);

        /// <summary>
        /// For pro pick readings, evaluate min max y-location where the ore can spawn in. Can be approximate
        /// </summary>
        /// <param name="miny"></param>
        /// <param name="maxy"></param>

When considered in combination, I believe the first section shows that the output of the second section is more or less directly applied, and that the second section shows the calculations being done based on approximate map geography and expected ore quantity. Much of this conclusion is drawn from the variable names, as I have neglected to find (and show) the specific definition of each variable, however, I wanted to document my work thus far so that others might be able to make progress and we might move additively towards a referenced understanding of the game's most debated -and perhaps most complex- mechanic, and might therefore be able to clarify the mining page.