Skip to content

Commit b2c3f95

Browse files
committed
Add: action0 prop 21 for rail stations
1 parent 2fefac5 commit b2c3f95

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

nml/actions/action0properties.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,17 @@ def station_tile_flags(value):
818818
]
819819

820820

821-
def station_minimum_bridge_height(value):
822-
if not isinstance(value, Array):
823-
raise generic.ScriptError("Flag list must be an array", value.pos)
824-
return [VariableByteListProp(0x20, [[flags.reduce_constant().value for flags in value.values]], True)]
821+
class array_for_station_properties:
822+
def __init__(self, prop_num, list_type="Flag"):
823+
self.prop_num = prop_num
824+
self.list_type = list_type
825+
826+
def __call__(self, value):
827+
if not isinstance(value, Array):
828+
raise generic.ScriptError(self.list_type + " list must be an array", value.pos)
829+
if len(value.values) % 2 != 0:
830+
generic.print_warning(generic.Warning.GENERIC, self.list_type + " list does not have even length", 0)
831+
return [VariableByteListProp(self.prop_num, [[flags.reduce_constant().value for flags in value.values]], True)]
825832

826833

827834
# fmt: off
@@ -849,7 +856,8 @@ def station_minimum_bridge_height(value):
849856
"name": {"size": 2, "num": (256, -1, 0x1C), "string": (256, 0xC5, 0xDC), "required": True},
850857
"classname": {"size": 2, "num": (256, -1, 0x1D), "string": (256, 0xC4, 0xDC)},
851858
"tile_flags": {"custom_function": station_tile_flags}, # = prop 1E
852-
"minimum_bridge_height": {"custom_function": station_minimum_bridge_height}, # = prop 20
859+
"minimum_bridge_height": {"custom_function": array_for_station_properties(0x20, list_type="Bridge heights")},
860+
"bridge_pillars_flags": {"custom_function": array_for_station_properties(0x21)},
853861
}
854862
# fmt: on
855863

0 commit comments

Comments
 (0)