Skip to content

Commit

Permalink
[SM64] Add exception handling for area init and throw error for insta…
Browse files Browse the repository at this point in the history
…nt warp objects (#390)

* [SM64] Add exception handling for area init and throw error for instant warp object

* Add back exception handeling
  • Loading branch information
Lilaa3 authored Dec 28, 2024
1 parent f0ff40c commit 85330e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fast64_internal/sm64/sm64_level_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,12 @@ def include_proto(file_name):
level_data.header_data += roomsC.header

# Get area
area = exportAreaCommon(
area_root, transformMatrix, geolayoutGraph.startGeolayout, collision, f"{level_name}_{areaName}"
)
try:
area = exportAreaCommon(
area_root, transformMatrix, geolayoutGraph.startGeolayout, collision, f"{level_name}_{areaName}"
)
except Exception as exc:
raise PluginError(f"Error while creating area {area_root.areaIndex}: {str(exc)}") from exc
if area.mario_start is not None:
prev_level_script.marioStart = area.mario_start
persistentBlockString = prev_level_script.get_persistent_block(
Expand Down
2 changes: 2 additions & 0 deletions fast64_internal/sm64/sm64_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,8 @@ class WarpNodeProperty(bpy.types.PropertyGroup):
expand: bpy.props.BoolProperty()

def uses_area_nodes(self):
if self.instantWarpObject1 is None or self.instantWarpObject2 is None:
raise PluginError(f"Warp Start and Warp End in Warp Node {self.warpID} must have objects selected.")
return (
self.instantWarpObject1.sm64_obj_type == "Area Root"
and self.instantWarpObject2.sm64_obj_type == "Area Root"
Expand Down

0 comments on commit 85330e1

Please sign in to comment.