Page 1 of 1

[0.18.26] Mining drills mine their last resource twice

Posted: Mon May 25, 2020 3:51 am
by raiguard
I have been trying to figure out how mining drills work so I can accurately represent mining drill rates in my Rate Calculator mod. While experimenting, I discovered that whichever resource is at the end of the drill's "list" gets two sets of mining operations (mined 20 times instead of 10).

Here is a video demonstrating the bug in action:



Here is the code for the "resource tracker" mod I created to help debug this:

Code: Select all

local draw_text = rendering.draw_text
local clear = rendering.clear

script.on_nth_tick(10, function()
  clear()
  local nauvis = game.surfaces.nauvis
  local resources = nauvis.find_entities_filtered{
    type = "resource"
  }

  for _, resource in ipairs(resources) do
    draw_text{
      text = resource.amount,
      surface = nauvis,
      target = resource,
      color = {r=1, g=1, b=1},
    }
  end
end)

Re: [0.18.26] Mining drills mine their last resource twice

Posted: Mon May 25, 2020 4:39 am
by Rseding91
Thanks for the report. I don't care if it works that way - making it work otherways will just add more complexity for no real gain. If one of the other developers wants to tinker with the logic and change it they are free to do so.