DivOresity

by Mylon

Ores are all mixed up! Adds a small logistical challenge dealing with impure ores. AKA "Diversity".

Content
10 months ago
0.16 - 2.0
1.99K
Mining

b Crash setting tile with 0 ore

6 days ago

I got:

The mod DivOresity (2.0.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event DivOresity::on_chunk_generated (ID 15)
Resource amount has to be larger than 0.
stack traceback:
[C]: in function 'create_entity'
DivOresity/control.lua:141: in function <DivOresity/control.lua:107>

It looks like the code is checking if the new amount to place is less than 1, but then changing the scale factor resulting in it placing a different amount than the one that was checked.

          local correction_factor = 1
            local amount = resource.amount * correction_factor
            if amount < 1 then
                goto next
            end
            if required_fluid then
                refugee = get_type(storage.extra_diverse_ores[surface.name][category][infinite][required_fluid])
            else
                refugee = get_type(storage.diverse_ores[surface.name][category][infinite])
            end
            correction_factor = richness_correction_factor(autoplace_controls, resource.name, refugee)
            surface.create_entity{name=refugee, position=resource.position, amount=resource.amount * correction_factor}

New response