Repository navigation
fix(game_types): use Factorio 2.0 names for rails, barrel and rocket items; add missing 2.0 entity statuses - #431
Open
hashbender wants to merge 1 commit into
Conversation
…items
- Prototype: add StraightRail, CurvedRailA, CurvedRailB and HalfDiagonalRail
so placed rails decode (the "rail" item places a straight-rail in 2.0).
- Prototype.Barrel = "barrel" (2.0 name); EmptyBarrel stays as an alias.
- Add Explosives, CliffExplosives, Landfill and RepairPack.
- Remove RocketControlUnit (no such item or recipe in 2.0).
- Rename CoalLiquifaction to CoalLiquefaction ("coal-liquefaction").
- Prototype.Rocket is the rocket launcher's ammo item: class ent.Ammo.
- EntityStatus: add waiting_for_more_items, waiting_for_rockets_to_arrive and
recipe_is_parameter, so entities in those states are not dropped.
- Fix the coal-liquefaction and solid-fuel comments.
- Tests: server-free check of every Prototype value against the items and
fluids of a 2.0.73 server, and of EntityStatus against defines.entity_status.
Update the rocket and assembler-recipe tests that used the removed names.
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
A few
Prototypemembers use names that don't exist in Factorio 2.0, and some 2.0 items have no member.craft_item,place_entity,insert_itemandextract_itemonly takePrototypemembers, andget_entitiesskips any entity whose name has no member. So:Prototype.Rail = "rail"is an item in 2.0 (it places astraight-rail). There is norailentity. Placed rails arestraight-rail,curved-rail-a,curved-rail-borhalf-diagonal-rail, none of which has a member, soget_entitiesdrops them androtate_entityraises aKeyErroronprototype_by_name[entity.name].Prototype.EmptyBarrel = "empty-barrel". 2.0 calls the itembarrel, socraft_item(Prototype.EmptyBarrel)sends a name that doesn't exist.explosives,cliff-explosives,landfillandrepair-packexist in 2.0 (all early-game technologies) but can't be crafted, inserted or extracted.Prototype.RocketControlUnit(rocket-control-unit) has no item or recipe in 2.0.Prototype.CoalLiquifaction = "coal-liquifaction". The recipe iscoal-liquefaction(RecipeName.CoalLiquefactionalready spells it right).Prototype.Rocket = "rocket"maps toent.Rocket(a silo rocket). In 2.0rocketis the rocket launcher's ammo item; the silo's rocket is the entityrocket-silo-rocket.EntityStatuslacks three 2.0 values fromdefines.entity_status:waiting_for_more_items,waiting_for_rockets_to_arriveandrecipe_is_parameter. An entity in one of these states fails pydantic validation, andget_entitiesprints "Could not create ..." and drops it.All
RecipeNamevalues are valid 2.0 recipe names; only itscoal-liquefactioncomment was wrong.Fix
Prototype:StraightRail,CurvedRailA,CurvedRailBandHalfDiagonalRail(classent.Rail).Railstays as the item.Barrel = "barrel".EmptyBarrelbecomes an alias of it, so existing code keeps working.Explosives,CliffExplosives,LandfillandRepairPack(items, classNone).RocketControlUnit.CoalLiquifactiontoCoalLiquefaction("coal-liquefaction"). Nothing in the repo used the old name, so no alias is kept;Prototype.CoalLiquifactionnow raisesAttributeError ... Did you mean: CoalLiquefaction?through the existing metaclass.Rocketmaps toent.Ammo, like the magazines.EntityStatus: addWAITING_FOR_MORE_ITEMS,WAITING_FOR_ROCKETS_TO_ARRIVEandRECIPE_IS_PARAMETER. Existing members are unchanged.RecipeName.CoalLiquefactionnow says it makes heavy oil, light oil and petroleum gas from coal, heavy oil and steam. The "These are recipes, not prototypes" comment is removed fromSolidFuel, which is an item.tests/entities/test_rockets.pyusedrocket-control-unit/Prototype.RocketControlUnit; it now usesprocessing-unit, which the 2.0 rocket-part recipe takes.tests/render/test_assembler_recipes.pyusesPrototype.Barrel/"barrel"and drops the RCU entries. The Prototype listing incondensed_prompts.pydropsRocketControlUnit.Testing
tests/unit/test_prototype_names.py(server-free, 15 tests):Prototypevalue is an item or fluid of a Factorio 2.0.73 headless server (base mod only), a placed-rail entity, one of the two recipe-name members, or one of FLE's group names.defines.entity_statusname in the 2.0.73 Lua API is anEntityStatusvalue.main; all pass on this branch.tests/unitpasses (19 tests).tests/entities/test_rockets.pyandtests/render/test_assembler_recipes.pyneed a server. I only checked that they collect (13 tests); I haven't run them.Notes
place_entity(Prototype.Rail)still fails: the Lua checksprototypes.entity["rail"]and uses one name for both the item and the entity. Fixing that means mapping an item to itsplace_resultinplace_entity/server.lua. I've left it out of this PR because I couldn't run it against a server here.LandfillandCliffExplosivescan now be crafted, inserted and extracted. FLE has no tool to place a tile or throw a capsule, so they can't be used on the map yet.game_types.py, so thePrototypelisting grows by about 10 lines.🤖 Generated with Claude Code