From 2273d97d86a1453a2ceda001178da0cff0534e6b Mon Sep 17 00:00:00 2001 From: Dennis Ploeger Date: Fri, 24 Sep 2021 23:05:18 +0200 Subject: [PATCH] fix: Adds validation fixes for commands (#401) Co-authored-by: Dennis Ploeger --- .../game/core-scripts/esc/commands/set_sound_state.gd | 2 +- addons/escoria-core/game/core-scripts/esc/types/esc_command.gd | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc/commands/set_sound_state.gd b/addons/escoria-core/game/core-scripts/esc/commands/set_sound_state.gd index b9675306..50886815 100644 --- a/addons/escoria-core/game/core-scripts/esc/commands/set_sound_state.gd +++ b/addons/escoria-core/game/core-scripts/esc/commands/set_sound_state.gd @@ -32,7 +32,7 @@ func validate(arguments: Array): ) return false if not arguments[1] in ["default", "off"] \ - or not ResourceLoader.exists(arguments[1]): + and not ResourceLoader.exists(arguments[1]): escoria.logger.report_errors( "SetSoundStateCommand.validate: invalid sound", [ diff --git a/addons/escoria-core/game/core-scripts/esc/types/esc_command.gd b/addons/escoria-core/game/core-scripts/esc/types/esc_command.gd index c063a8a3..adea2b14 100644 --- a/addons/escoria-core/game/core-scripts/esc/types/esc_command.gd +++ b/addons/escoria-core/game/core-scripts/esc/types/esc_command.gd @@ -113,7 +113,8 @@ func run() -> int: var prepared_arguments = argument_descriptor.prepare_arguments( self.parameters ) - if argument_descriptor.validate(self.name, prepared_arguments): + if argument_descriptor.validate(self.name, prepared_arguments) and\ + command_object.validate(prepared_arguments): escoria.logger.debug("Running command %s with parameters %s" % [ self.name, prepared_arguments