Repository navigation
fix(research): name every Factorio 2.0 technology, accept names, list closest on unknown - #430
Open
hashbender wants to merge 1 commit into
Open
hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
… closest on unknown - Technology: add the 136 base-game Factorio 2.0 technologies that had no member (bulk-inserter, research-speed-1..6, military-3, electric-mining-drill, ...), named after the prototype name (bulk-inserter -> BulkInserter). - set_research / get_research_progress: document that a technology name string is accepted (it already was), and append the closest technology names to the "does not exist" / "doesn't exist" error. - Add closest_technology_names() to game_types. - Tests: server-free check of the enum against the 196 technologies of a 2.0.73 server, plus set_research by name and with an unknown name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Technologycovers 60 of the 196 technologies in Factorio 2.0 (base game). For the other 136, agents can't writeTechnology.X:Examples of the missing ones:
electric-mining-drill,radar,lamp,gun-turret,military-3,research-speed-2..-6,inserter-capacity-bonus-3..-7,modules,speed-module,efficiency-module,construction-robotics,logistic-roboticsandadvanced-combinators.The tools already accept a technology name string (
set_research("radar")works), because the clients usetechnology.valueonly when it's there. The docs only mention the enum, though, so agents that don't find a member assume the technology can't be researched. Agents have also been seen tryingset_research("research-speed")or"stack-inserter"(Factorio 1.1 names). The only reply isTechnology research-speed does not exist, with nothing to say what the 2.0 name is.Fix
game_types.Technology: add a member for each of the 136 missing technologies. Each one is named after its prototype name:electric-mining-drill->ElectricMiningDrill,research-speed-2->ResearchSpeed2. Existing members and aliases are unchanged, and none of the new names collide with them.game_types.closest_technology_names(name): returns the technology names closest toname. It lists the same name written as a member ("BulkInserter"->bulk-inserter) first, then the levels of a leveled technology ("research-speed"->research-speed-1..-6), then thedifflibmatches.set_research/get_research_progress: when the game says the technology does not exist, the error now ends with. Closest technology names: .... Every other message is unchanged.agent.mdfiles say a name string is accepted.Union[Technology, str].get_research_progressexample checked"Technology doesn't exist" in str(e), which never matches the real message (Technology <name> doesn't exist). It now checks"doesn't exist" in str(e).Testing
tests/unit/test_technology_names.py(server-free, 7 tests):Technologyvalues is exactly the 196 names fromgame.forces.player.technologieson a Factorio 2.0.73 headless server (base mod only).closest_technology_namescases.executestubbed.tests/unitpasses (11 tests).tests/actions/test_set_research.py:test_set_research_by_nameandtest_set_research_unknown_name_lists_closest_names. They need a server and are left to thefactorio-testworkflow; I haven't run them on this branch.set_research("radar"),set_research(Technology.ElectricMiningDrill),get_research_progress(Technology.Lamp)andget_research_progress("stone-wall")returned the game's ingredients.set_research("stack-inserter")raisedTechnology stack-inserter does not exist. Closest technology names: fast-inserter, bulk-inserter.agent.mdfiles.Notes
game_types.py, so theTechnologylisting in it grows by 136 lines.🤖 Generated with Claude Code