From 31b57505b59008b0d013251dbbf7b94e9b0cdb89 Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Fri, 4 Feb 2022 17:10:23 -0500 Subject: [PATCH 1/3] fix: set a proper guard in case of no speaking animations and correct the upper limit check for the speaking index --- addons/escoria-core/game/core-scripts/esc_item.gd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index e3f3f3ed..cca3a4f6 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -452,9 +452,11 @@ func turn_to(object: Node, wait: float = 0.0): # Play the talking animation func start_talking(): - if get_animation_player() and \ - _movable.last_dir >= 0 and \ - _movable.last_dir <= animations.speaks.size(): + # Only start the speaking animation if we actually have them setup + if animations.speaks.size() > 0 \ + and 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( From 9d16122d1a1e8a9e3c02433f7f6a7d000ebea1d6 Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Sat, 5 Feb 2022 13:08:20 -0500 Subject: [PATCH 2/3] Also need this here. --- addons/escoria-core/game/core-scripts/esc_item.gd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index cca3a4f6..65b72347 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -466,9 +466,10 @@ func start_talking(): # Stop playing the talking animation func stop_talking(): - if get_animation_player() and \ - _movable.last_dir >= 0 and \ - _movable.last_dir <= animations.idles.size(): + if animations.speaks.size() > 0 \ + and 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( From ea3543b5ee612b08d0bc4538184300a69b572e79 Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Wed, 16 Feb 2022 10:57:21 -0500 Subject: [PATCH 3/3] fix: guard for cases where no animations are set. --- addons/escoria-core/game/core-scripts/esc_item.gd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index 65b72347..6c7fdcce 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -453,7 +453,8 @@ func turn_to(object: Node, wait: float = 0.0): # Play the talking animation func start_talking(): # Only start the speaking animation if we actually have them setup - if animations.speaks.size() > 0 \ + if animations.speaks != null \ + and animations.speaks.size() > 0 \ and get_animation_player() \ and _movable.last_dir >= 0 \ and _movable.last_dir < animations.speaks.size(): @@ -466,7 +467,8 @@ func start_talking(): # Stop playing the talking animation func stop_talking(): - if animations.speaks.size() > 0 \ + if animations.speaks != null \ + and animations.speaks.size() > 0 \ and get_animation_player() \ and _movable.last_dir >= 0 \ and _movable.last_dir < animations.speaks.size():