Skip to content

Commit

Permalink
Never return "" instances when doing instanceLoc lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Sep 29, 2015
1 parent faf665b commit 169c90c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,8 @@ def res_add_brush(inst, res):
point1.z -= 64 # Offset to the location of the floor
point2.z -= 64

point1.rotate_by_str(inst['angles']) # Rotate to match the instance
# Rotate to match the instance
point1.rotate_by_str(inst['angles'])
point2.rotate_by_str(inst['angles'])

origin = Vec.from_str(inst['origin'])
Expand Down
12 changes: 9 additions & 3 deletions src/instanceLocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def resolve(path) -> list:
- "[spExitCorridor]": Hardcoded shortcuts for specific items
This returns a list of instances which match the selector.
When using <> values, the '' path will never be returned.
"""

if path.startswith('<') and path.endswith('>'):
Expand Down Expand Up @@ -195,13 +196,18 @@ def resolve(path) -> list:
'"' + val + '" is not a valid instance'
' subtype or index!'
)
# Only add if it's actually in range
if 0 <= ind < len(item_values):
# Only add if it's actually in range, and skip "" values
if 0 <= ind < len(item_values) and item_values[ind] != '':
out.append(item_values[ind])
return out
else:
try:
return INSTANCE_FILES[path]
# Skip "" instances
return [
inst for inst in
INSTANCE_FILES[path]
if inst != ''
]
except KeyError:
utils.con_log(
'"{}" not a valid item!'.format(path)
Expand Down

0 comments on commit 169c90c

Please sign in to comment.