diff --git a/worlds/factorio/Options.py b/worlds/factorio/Options.py index 5a41250fa760..dd17e2d68bdd 100644 --- a/worlds/factorio/Options.py +++ b/worlds/factorio/Options.py @@ -6,7 +6,7 @@ from schema import Schema, Optional, And, Or from Options import Choice, OptionDict, OptionSet, DefaultOnToggle, Range, DeathLink, Toggle, \ - StartInventoryPool, PerGameCommonOptions + StartInventoryPool, PerGameCommonOptions, OptionGroup # schema helpers FloatRange = lambda low, high: And(Or(int, float), lambda f: low <= f <= high) @@ -293,7 +293,7 @@ class FactorioWorldGen(OptionDict): with in-depth documentation at https://lua-api.factorio.com/latest/Concepts.html#MapGenSettings""" display_name = "World Generation" # FIXME: do we want default be a rando-optimized default or in-game DS? - value: typing.Dict[str, typing.Dict[str, typing.Any]] + value: dict[str, dict[str, typing.Any]] default = { "autoplace_controls": { # terrain @@ -402,7 +402,7 @@ class FactorioWorldGen(OptionDict): } }) - def __init__(self, value: typing.Dict[str, typing.Any]): + def __init__(self, value: dict[str, typing.Any]): advanced = {"pollution", "enemy_evolution", "enemy_expansion"} self.value = { "basic": {k: v for k, v in value.items() if k not in advanced}, @@ -421,7 +421,7 @@ def optional_min_lte_max(container, min_key, max_key): optional_min_lte_max(enemy_expansion, "min_expansion_cooldown", "max_expansion_cooldown") @classmethod - def from_any(cls, data: typing.Dict[str, typing.Any]) -> FactorioWorldGen: + def from_any(cls, data: dict[str, typing.Any]) -> FactorioWorldGen: if type(data) == dict: return cls(data) else: @@ -435,7 +435,7 @@ class ImportedBlueprint(DefaultOnToggle): class EnergyLink(Toggle): """Allow sending energy to other worlds. 25% of the energy is lost in the transfer.""" - display_name = "EnergyLink" + display_name = "Energy Link" @dataclass @@ -473,3 +473,34 @@ class FactorioOptions(PerGameCommonOptions): death_link: DeathLink energy_link: EnergyLink start_inventory_from_pool: StartInventoryPool + + +option_groups: list[OptionGroup] = [ + OptionGroup( + "Technologies", + [ + TechTreeLayout, + Progressive, + MinTechCost, + MaxTechCost, + TechCostDistribution, + TechCostMix, + RampingTechCosts, + TechTreeInformation, + ] + ), + OptionGroup( + "Traps", + [ + AttackTrapCount, + EvolutionTrapCount, + EvolutionTrapIncrease, + TeleportTrapCount, + GrenadeTrapCount, + ClusterGrenadeTrapCount, + ArtilleryTrapCount, + AtomicRocketTrapCount, + ], + start_collapsed=True + ), +] diff --git a/worlds/factorio/__init__.py b/worlds/factorio/__init__.py index 9f1f3cb573f9..dd14ab434717 100644 --- a/worlds/factorio/__init__.py +++ b/worlds/factorio/__init__.py @@ -12,7 +12,8 @@ from worlds.generic import Rules from .Locations import location_pools, location_table from .Mod import generate_mod -from .Options import FactorioOptions, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal, TechCostDistribution +from .Options import (FactorioOptions, MaxSciencePack, Silo, Satellite, TechTreeInformation, Goal, + TechCostDistribution, option_groups) from .Shapes import get_shapes from .Technologies import base_tech_table, recipe_sources, base_technology_table, \ all_product_sources, required_technologies, get_rocket_requirements, \ @@ -61,6 +62,7 @@ class FactorioWeb(WebWorld): "setup/en", ["Berserker, Farrak Kilhn"] )] + option_groups = option_groups class FactorioItem(Item):