[2.0.33] Infinite research.level off by one

Bugs that are actually features.
jurgy
Inserter
Inserter
Posts: 30
Joined: Wed Feb 27, 2019 5:55 pm
Contact:

[2.0.33] Infinite research.level off by one

Post by jurgy »

(Tested without Space-Age enabled)

I noticed in an on_research_finished event that the event.research.technology.level is one too high for the infinite research.

I'm not sure if this is related to this report or if this has any practical effect, besides modding but here's a repro:

Code: Select all

local on_research_finished = function(event)
    local technology = event.research
    local name = technology.name
    log("name: " .. name .. " | level: " .. technology.level)
end

local test_command = function(event)
    game.player.force.technologies["physical-projectile-damage-1"].researched = true
    game.player.force.technologies["physical-projectile-damage-2"].researched = true
    game.player.force.technologies["physical-projectile-damage-3"].researched = true
    game.player.force.technologies["physical-projectile-damage-4"].researched = true
    game.player.force.technologies["physical-projectile-damage-5"].researched = true
    game.player.force.technologies["physical-projectile-damage-6"].researched = true
    game.player.force.technologies["physical-projectile-damage-7"].researched = true
    game.player.force.technologies["physical-projectile-damage-7"].level = 10
end

commands.add_command("test", nil, test_command)

script.on_event(defines.events.on_research_finished, on_research_finished)
Logs:

Code: Select all

name: physical-projectile-damage-1 | level: 1
name: physical-projectile-damage-2 | level: 2
name: physical-projectile-damage-3 | level: 3
name: physical-projectile-damage-4 | level: 4
name: physical-projectile-damage-5 | level: 5
name: physical-projectile-damage-6 | level: 6
name: physical-projectile-damage-7 | level: 8
name: physical-projectile-damage-7 | level: 9
name: physical-projectile-damage-7 | level: 10
To be certain that this also happens when you unlock it with a labs, instead of with a script, I played through the last steps of the game (without space-age) and found the behavior to be similar.

Here's the logs from when I unlocked space science, which let me research the infinite projectile damage.

Code: Select all

name: physical-projectile-damage-6 | level: 6
name: space-science-pack | level: 1
name: physical-projectile-damage-7 | level: 8
name: physical-projectile-damage-7 | level: 9
I've only tested it for physical projectile damage and a modded science, but I assume this is the case for all infinite techs.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15997
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.33] Infinite research.level off by one

Post by Rseding91 »

Thanks for the report however this is working correctly. Per the docs here: https://lua-api.factorio.com/latest/cla ... html#level level for infinite technologies is always "one higher than the researched level" - as in - this is the next available level available for research.

Infinite technologies of a given instance are all 1 technology instance on the force with a single "level" value. When you finish a research, the level is increased by 1 signaling it is finished researching the previous level, and then the Lua event fired.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”