Factorio: option groups (#4293)
This commit is contained in:
parent
a537d8eb65
commit
0705f6e6c0
|
@ -6,7 +6,7 @@ import typing
|
||||||
from schema import Schema, Optional, And, Or
|
from schema import Schema, Optional, And, Or
|
||||||
|
|
||||||
from Options import Choice, OptionDict, OptionSet, DefaultOnToggle, Range, DeathLink, Toggle, \
|
from Options import Choice, OptionDict, OptionSet, DefaultOnToggle, Range, DeathLink, Toggle, \
|
||||||
StartInventoryPool, PerGameCommonOptions
|
StartInventoryPool, PerGameCommonOptions, OptionGroup
|
||||||
|
|
||||||
# schema helpers
|
# schema helpers
|
||||||
FloatRange = lambda low, high: And(Or(int, float), lambda f: low <= f <= high)
|
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"""
|
with in-depth documentation at https://lua-api.factorio.com/latest/Concepts.html#MapGenSettings"""
|
||||||
display_name = "World Generation"
|
display_name = "World Generation"
|
||||||
# FIXME: do we want default be a rando-optimized default or in-game DS?
|
# 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 = {
|
default = {
|
||||||
"autoplace_controls": {
|
"autoplace_controls": {
|
||||||
# terrain
|
# 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"}
|
advanced = {"pollution", "enemy_evolution", "enemy_expansion"}
|
||||||
self.value = {
|
self.value = {
|
||||||
"basic": {k: v for k, v in value.items() if k not in advanced},
|
"basic": {k: v for k, v in value.items() if k not in advanced},
|
||||||
|
@ -421,7 +421,7 @@ class FactorioWorldGen(OptionDict):
|
||||||
optional_min_lte_max(enemy_expansion, "min_expansion_cooldown", "max_expansion_cooldown")
|
optional_min_lte_max(enemy_expansion, "min_expansion_cooldown", "max_expansion_cooldown")
|
||||||
|
|
||||||
@classmethod
|
@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:
|
if type(data) == dict:
|
||||||
return cls(data)
|
return cls(data)
|
||||||
else:
|
else:
|
||||||
|
@ -435,7 +435,7 @@ class ImportedBlueprint(DefaultOnToggle):
|
||||||
|
|
||||||
class EnergyLink(Toggle):
|
class EnergyLink(Toggle):
|
||||||
"""Allow sending energy to other worlds. 25% of the energy is lost in the transfer."""
|
"""Allow sending energy to other worlds. 25% of the energy is lost in the transfer."""
|
||||||
display_name = "EnergyLink"
|
display_name = "Energy Link"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -473,3 +473,34 @@ class FactorioOptions(PerGameCommonOptions):
|
||||||
death_link: DeathLink
|
death_link: DeathLink
|
||||||
energy_link: EnergyLink
|
energy_link: EnergyLink
|
||||||
start_inventory_from_pool: StartInventoryPool
|
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
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
|
@ -12,7 +12,8 @@ from worlds.LauncherComponents import Component, components, Type, launch_subpro
|
||||||
from worlds.generic import Rules
|
from worlds.generic import Rules
|
||||||
from .Locations import location_pools, location_table
|
from .Locations import location_pools, location_table
|
||||||
from .Mod import generate_mod
|
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 .Shapes import get_shapes
|
||||||
from .Technologies import base_tech_table, recipe_sources, base_technology_table, \
|
from .Technologies import base_tech_table, recipe_sources, base_technology_table, \
|
||||||
all_product_sources, required_technologies, get_rocket_requirements, \
|
all_product_sources, required_technologies, get_rocket_requirements, \
|
||||||
|
@ -61,6 +62,7 @@ class FactorioWeb(WebWorld):
|
||||||
"setup/en",
|
"setup/en",
|
||||||
["Berserker, Farrak Kilhn"]
|
["Berserker, Farrak Kilhn"]
|
||||||
)]
|
)]
|
||||||
|
option_groups = option_groups
|
||||||
|
|
||||||
|
|
||||||
class FactorioItem(Item):
|
class FactorioItem(Item):
|
||||||
|
|
Loading…
Reference in New Issue