judos / robotMiningSite

A factorio mod
GNU General Public License v3.0
5 stars 2 forks source link

Mining robot speed research doesn't work #19

Closed almightyju closed 4 years ago

almightyju commented 6 years ago

This code: https://github.com/judos/robotMiningSite/blob/b82ca568766d138fde87565c08e8f6cb5f4ea9f5/source/control/speedTechnology.lua#L7-L17

Doesn't work since the research name is "mining-robot-speed-x", plus it resets the speed after the 3rd research to 0.

I've used this code for the speedTechnology file which seems to work and I adjusted the speed increase to feel a bit more substantial but not sure about the balancing

function speedTechnologyInit()
    if global.robotMiningSite.speedResearch==nil then
        global.robotMiningSite.speedResearch = 0
    end
end

script.on_event(defines.events.on_research_finished,function(event)
    local research = event.research
    local miningForce = game.forces[miningForceForForce(research.force.name)]
    local prefix = "mining-robot-speed"

    if research.name:sub(1, #prefix) == prefix then
        miningForce.worker_robots_speed_modifier = miningForce.worker_robots_speed_modifier + 0.5
    end
end)
Cordina90 commented 4 years ago

Robot speed technologie has been reworked, should be working now.