From ff178541fca9ecc1694af5b6e675c600452c8ceb Mon Sep 17 00:00:00 2001 From: Duncan Brown Date: Tue, 10 May 2022 14:35:48 -0400 Subject: [PATCH] fix: avoids crashes in case of input when room is run directly and interrupted; may look at updating room manager in the future --- addons/escoria-core/game/core-scripts/esc/commands/walk.gd | 3 ++- .../escoria-core/game/core-scripts/esc/commands/walk_block.gd | 2 +- .../escoria-core/game/core-scripts/esc/commands/walk_to_pos.gd | 2 +- .../game/core-scripts/esc/commands/walk_to_pos_block.gd | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc/commands/walk.gd b/addons/escoria-core/game/core-scripts/esc/commands/walk.gd index 652e19a6..6666e62e 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/walk.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/walk.gd @@ -72,4 +72,5 @@ func run(command_params: Array) -> int: # Function called when the command is interrupted. func interrupt(): - walking_object_node.stop_walking_now() + if walking_object_node != null: + walking_object_node.stop_walking_now() diff --git a/addons/escoria-core/game/core-scripts/esc/commands/walk_block.gd b/addons/escoria-core/game/core-scripts/esc/commands/walk_block.gd index 00cc22f5..ef90301c 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/walk_block.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/walk_block.gd @@ -73,5 +73,5 @@ func run(command_params: Array) -> int: # Function called when the command is interrupted. func interrupt(): - if not walking_object_node is ESCPlayer: + if walking_object_node != null and not walking_object_node is ESCPlayer: walking_object_node.stop_walking_now() diff --git a/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos.gd b/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos.gd index 09635491..fd783474 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos.gd @@ -62,5 +62,5 @@ func run(command_params: Array) -> int: # Function called when the command is interrupted. func interrupt(): - if not walking_object_node is ESCPlayer: + if walking_object_node != null and not walking_object_node is ESCPlayer: walking_object_node.stop_walking_now() diff --git a/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos_block.gd b/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos_block.gd index ddc80f69..e3fa5bd8 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos_block.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/walk_to_pos_block.gd @@ -66,5 +66,5 @@ func run(command_params: Array) -> int: # Function called when the command is interrupted. func interrupt(): - if not walking_object_node is ESCPlayer: + if walking_object_node != null and not walking_object_node is ESCPlayer: walking_object_node.stop_walking_now()