TL;DR
(see attachment comment)Full Bug Report
Background: API docs for LuaTechnology say:- LuaTechnology.enabled: Can this technology be researched?
- LuaTechnology.visible_when_disabled: = If this technology will be visible in the research GUI even though it is disabled.
Make a totally fresh freeplay save, and focus on military-2. Use this console command:
/c game.forces["player"].technologies["logistic-science-pack"].research_recursive();
game.forces["player"].technologies["military"].researched = true;
This gets us to a normal tech tree game-state where military-2 would be researchable except for steel-processing not being researched. Use this console command:
/c game.forces["player"].technologies["steel-processing"].visible_when_disabled = false;
game.forces["player"].technologies["steel-processing"].enabled = false;
Now steel-processing a hidden, unresearched, disabled prerequisite of military-2, which properly hides steel-processing. However, military-2 cannot be researched, as steel-processing is still a prereq. Put in this console command:
/c game.forces["player"].technologies["steel-processing"].researched = true;
Now steel-processing is researched, so military-2 can be researched. However, steel-processing has been forced to be enabled.
/c game.forces["player"].technologies["steel-processing"].enabled = false
Now steel-processing is researched, disabled, visible_when_disabled false, but still visible in the tech tree. Furthermore, steel-processing is researched, but still blocking military-2 as a prerequisite.
What did you expect to happen instead?
- I expect the last picture to have steel-processing hidden from the tech tree, because it is a disabled technology that is visible_when_disabled = false. Specifically, I expect visible_when_disabled to always take priority over any other logic that affects visibility.
- I expect a researched and disabled technology to satisfy prerequisite requirements (ie military-2 to be researchable when steel-processing is disabled and researched). Specifically, I expect LuaTechnology.enabled to have no bearing on a tech satisfying prerequisite requirements (which should only depend on LuaTechnology.researched.
Why fix? I am trying to make a system to hide technologies in the middle of a tech tree that have dependents. Fixing this will allow me to implement a system of hiding techs (by hiding/revealing placeholder tech prototypes) that still show the shape of the tech tree.
Let me know if this should be a modding interface request, but it seems like a bug because the properties don’t seem to do what they are supposed to.
EDIT: I saw .researched = true automatically set enabled=true, which revealed more problems than it fixed.
EDIT2: Added tl;dr