[0.17.35] API - Technology on researched state change enables technology

Bugs that are actually features.
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 283
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

[0.17.35] API - Technology on researched state change enables technology

Post by Muppet9010 »

If you change the researched state of a technology via API the technology becomes enabled automatically. Either this is a bug or if intended behaviour please confirm and the API documents need updating as this isn't obvious behaviour.

https://lua-api.factorio.com/latest/Lua ... researched

I have a custom multiple level, upgrade-able technology. So like an infinite tech.

If I do the below pseudo code the tech is enabled still after un-researching it:

Code: Select all

local tech = game.forces["player"].technologies["my-tech"]
tech.enabled = false
tech.level = 1
tech.researched = false
But this pseudo code disables the tech after un-researching it.

Code: Select all

local tech = game.forces["player"].technologies["my-tech"]
tech.level = 1
tech.researched = false
tech.enabled = false
Rseding91
Factorio Staff
Factorio Staff
Posts: 16099
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.35] API - Technology on researched state change enables technology

Post by Rseding91 »

Thanks for the report. I can confirm that writing the "level" changes the enabled state to true by design. If you don't want it enabled after setting the level you need to do that first, then write enabled.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”