Skip to content

Commit b8f4edf

Browse files
Berserker66James McIntosh
authored andcommitted
Factorio: fix FloatRanges writing effectively nil into the mod (ArchipelagoMW#4846)
1 parent 1963f11 commit b8f4edf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

worlds/factorio/Options.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88
from Options import Choice, OptionDict, OptionSet, DefaultOnToggle, Range, DeathLink, Toggle, \
99
StartInventoryPool, PerGameCommonOptions, OptionGroup
1010

11+
1112
# schema helpers
1213
class FloatRange:
1314
def __init__(self, low, high):
1415
self._low = low
1516
self._high = high
1617

17-
def validate(self, value):
18+
def validate(self, value) -> float:
1819
if not isinstance(value, (float, int)):
1920
raise SchemaError(f"should be instance of float or int, but was {value!r}")
2021
if not self._low <= value <= self._high:
2122
raise SchemaError(f"{value} is not between {self._low} and {self._high}")
23+
return float(value)
24+
2225

2326
LuaBool = Or(bool, And(int, lambda n: n in (0, 1)))
2427

0 commit comments

Comments
 (0)