Skip to content

Commit

Permalink
fix: Safety guard for characters without speaking animations (#457)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Ploeger <[email protected]>
  • Loading branch information
dploeger and dploeger authored Nov 22, 2021
1 parent 8790222 commit f4c5803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions addons/escoria-core/game/core-scripts/esc_item.gd
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,9 @@ func turn_to(object: Node, wait: float = 0.0):

# Play the talking animation
func start_talking():
if get_animation_player():
if get_animation_player() and \
_movable.last_dir >= 0 and \
_movable.last_dir <= animations.speaks.size():
if get_animation_player().is_playing():
get_animation_player().stop()
get_animation_player().play(
Expand All @@ -452,7 +454,9 @@ func start_talking():

# Stop playing the talking animation
func stop_talking():
if get_animation_player():
if get_animation_player() and \
_movable.last_dir >= 0 and \
_movable.last_dir <= animations.idles.size():
if get_animation_player().is_playing():
get_animation_player().stop()
get_animation_player().play(
Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ ui/inventory_item_size=Vector2( 72, 72 )
debug/enable_room_selector=true
debug/room_selector_room_dir="res://game/rooms"
ui/dialog_managers=[ "res://addons/escoria-dialog-simple/esc_dialog_simple.gd" ]
ui/default_dialog_type="avatar"
ui/default_dialog_type="floating"
dialog_simple/avatars_path="res://game/dialog_avatars"
dialog_simple/text_speed_per_character=0.1
dialog_simple/fast_text_speed_per_character=0.25
Expand Down

0 comments on commit f4c5803

Please sign in to comment.