Factorio: add Traps

This commit is contained in:
Fabian Dill
2021-08-04 05:40:51 +02:00
parent 16701249b4
commit 9408557f03
7 changed files with 173 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
import typing
from Options import Choice, OptionDict, Option, DefaultOnToggle
from Options import Choice, OptionDict, Option, DefaultOnToggle, Range
from schema import Schema, Optional, And, Or
# schema helpers
@@ -125,6 +125,27 @@ class FactorioStartItems(OptionDict):
default = {"burner-mining-drill": 19, "stone-furnace": 19}
class TrapCount(Range):
range_end = 4
class AttackTrapCount(TrapCount):
"""Trap items that when received trigger an attack on your base."""
displayname = "Attack Traps"
class EvolutionTrapCount(TrapCount):
"""Trap items that when received increase the enemy evolution."""
displayname = "Evolution Traps"
class EvolutionTrapIncrease(Range):
displayname = "Evolution Trap % Effect"
range_start = 1
default = 10
range_end = 100
class FactorioWorldGen(OptionDict):
displayname = "World Generation"
# FIXME: do we want default be a rando-optimized default or in-game DS?
@@ -257,9 +278,11 @@ class FactorioWorldGen(OptionDict):
else:
raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}")
class ImportedBlueprint(DefaultOnToggle):
displayname = "Blueprints"
factorio_options: typing.Dict[str, type(Option)] = {
"max_science_pack": MaxSciencePack,
"tech_tree_layout": TechTreeLayout,
@@ -272,5 +295,8 @@ factorio_options: typing.Dict[str, type(Option)] = {
"recipe_ingredients": RecipeIngredients,
"imported_blueprints": ImportedBlueprint,
"world_gen": FactorioWorldGen,
"progressive": Progressive
"progressive": Progressive,
"evolution_traps": EvolutionTrapCount,
"attack_traps": AttackTrapCount,
"evolution_trap_increase": EvolutionTrapIncrease,
}