Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions nml/actions/action0properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def prop_value(value, index):
return value if index == 0 else None
if isinstance(value, Array) and len(value.values) == 2 and isinstance(value.values[index], ConstantNumeric):
return value.values[index]
raise generic.ScriptError("refittable_cargo_classes must be a constant or an array of 2 constants")
raise generic.ScriptError("refittable_cargo_classes must be a constant or an array of 2 constants", value.pos)

def prop_test(value):
return value is not None
Expand All @@ -419,7 +419,7 @@ def single_or_list(prop_name, single_num, multiple_num, value):
if len(value.values) == 1:
return [Action0Property(single_num, value.values[0].reduce_constant(), 1)]
return [VariableByteListProp(multiple_num, [[type.reduce_constant().value for type in value.values]])]
raise generic.ScriptError("'{}' must be a constant or an array of constants".format(prop_name))
raise generic.ScriptError("'{}' must be a constant or an array of constants".format(prop_name), value.pos)


#
Expand Down Expand Up @@ -782,6 +782,8 @@ def station_layouts(value):
for layout in value.values:
if not isinstance(layout, Array) or len(layout.values) == 0:
raise generic.ScriptError("A station layout must be an array of platforms", layout.pos)
if not isinstance(layout.values[0], Array):
raise generic.ScriptError("A platform must be an array of tile types", layout.values[0].pos)
length = len(layout.values[0].values)
number = len(layout.values)
if (length, number) in layouts:
Expand All @@ -791,7 +793,7 @@ def station_layouts(value):
layouts[(length, number)] = []
for platform in layout.values:
if not isinstance(platform, Array) or len(platform.values) == 0:
raise generic.ScriptError("A platform must be an array of tile types")
raise generic.ScriptError("A platform must be an array of tile types", platform.pos)
if len(platform.values) != length:
raise generic.ScriptError("All platforms in a station layout must have the same length", platform.pos)
for type in platform.values:
Expand Down