Dredgeworks

by Kubius

Ore patches now spill over into the sea as submerged variants. Dredge them up with new floating hardware, and build deeper into the blue with water-placeable refined concrete.

Content
25 days ago
1.1 - 2.0
5.50K
Logistics Environment Mining

b [Fixed?] Resources generated by Resource Spawner Overhaul are not all transformed into submerged tiles

a month ago

Resource Spawner Overhaul manually places the ores, I modified the control.lua file to fix it.

function init_events()
    log("dredgeworks: preparing ore submersion")
    if script.active_mods["rso-mod"] then
        script.on_event(defines.events.script_raised_built, function (e)
            if string.find(e.entity.name, "deep-") then
                return
            end
            local deposit = e.entity
            local surface = deposit.surface
            if (surface.count_tiles_filtered{position=deposit.position, radius=deposit.get_radius(), collision_mask="water_tile"} == 1 ) then
                local try_deep = "deep-" .. deposit.name
                if(deposit.prototype.mineable_properties) then
                    if(prototypes.entity[try_deep]) then
                        local oldpos = deposit.position
                        local oldamt = deposit.amount
                        local checkrad = deposit.get_radius() + 1 --clean edges
                        deposit.destroy()
                        if (surface.count_tiles_filtered{position=oldpos, radius=checkrad, collision_mask="ground_tile"} == 0 ) then
                            surface.create_entity{name=try_deep, amount=oldamt, position=oldpos}
                        end
                    elseif((not allow_floating_edgecase) and deposit.prototype.mineable_properties.products[1].type ~= "fluid") then
                        deposit.destroy()
                    end
                else
                    deposit.destroy()
                end
            end
        end, {{filter = "type", type = "resource"}})
    else
        script.on_event(defines.events.on_chunk_generated, submergeOre)
    end
end
a month ago

Hi,
resource Spawner Overhaul manually places the ores, I modified the control.lua file to fix it.

function init_events() log("dredgeworks: preparing ore submersion") if script.active_mods["rso-mod"] then script.on_event(defines.events.script_raised_built, function (e) if string.find(e.entity.name, "deep-") then return end local deposit = e.entity local surface = deposit.surface if (surface.count_tiles_filtered{position=deposit.position, radius=deposit.get_radius(), collision_mask="water_tile"} == 1 ) then local try_deep = "deep-" .. deposit.name if(deposit.prototype.mineable_properties) then if(prototypes.entity[try_deep]) then local oldpos = deposit.position local oldamt = deposit.amount local checkrad = deposit.get_radius() + 1 --clean edges deposit.destroy() if (surface.count_tiles_filtered{position=oldpos, radius=checkrad, collision_mask="ground_tile"} == 0 ) then surface.create_entity{name=try_deep, amount=oldamt, position=oldpos} end elseif((not allow_floating_edgecase) and deposit.prototype.mineable_properties.products[1].type ~= "fluid") then deposit.destroy() end else deposit.destroy() end end end, {{filter = "type", type = "resource"}}) else script.on_event(defines.events.on_chunk_generated, submergeOre) end end

a month ago

Having a hard time parsing this at a glance, but appears that RSO has its own distinct resource placement procedure and you've made an altered behavior that works with that procedure? I can look into a compatibility "switch" for that, if i did read correctly.

a month ago

Yes, RSO manually places resources and triggers script_raised_built events. My code snippet is a bit dirty and can be improved.

a month ago

Working on a tidier version. No ETA on deployment, since I need to do some compatibility checks and I'm not sure when I'll be able to get to them.

a month ago
(updated a month ago)

Figured it out; both starting patches and the RSO-altered patches should work as of 0.5.3.

New response