Options: verify starting inventory counts are positive for more than just Factorio

This commit is contained in:
Fabian Dill
2021-10-25 04:13:25 +02:00
parent 57831f0eba
commit 375a0ff208
2 changed files with 14 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
import typing
from Options import Choice, OptionDict, Option, DefaultOnToggle, Range
from Options import Choice, OptionDict, ItemDict, Option, DefaultOnToggle, Range
from schema import Schema, Optional, And, Or
# schema helpers
@@ -120,15 +120,11 @@ class RecipeIngredients(Choice):
option_science_pack = 1
class FactorioStartItems(OptionDict):
class FactorioStartItems(ItemDict):
displayname = "Starting Items"
verify_item_name = False
default = {"burner-mining-drill": 19, "stone-furnace": 19}
def __init__(self, value: typing.Dict[str, typing.Any]):
if any(item_count < 1 for item_count in value.values()):
raise Exception("Cannot have non-positive item counts.")
super().__init__(value)
class TrapCount(Range):
range_end = 4