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 40c19058..bc2bd595 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 @@ -117,11 +117,10 @@ func run() -> int: return ESCExecution.RC_ERROR else: var argument_descriptor = command_object.configure() - var prepared_arguments = argument_descriptor.prepare_arguments( - self.parameters - ) - if argument_descriptor.validate(self.name, prepared_arguments) and\ - command_object.validate(prepared_arguments): + if command_object.validate(self.parameters): + var prepared_arguments = argument_descriptor.prepare_arguments( + self.parameters + ) escoria.logger.debug("Running command %s with parameters %s" % [ self.name, prepared_arguments diff --git a/addons/escoria-core/game/core-scripts/esc/types/esc_command_argument_descriptor.gd b/addons/escoria-core/game/core-scripts/esc/types/esc_command_argument_descriptor.gd index a79b1be5..2342803e 100644 --- a/addons/escoria-core/game/core-scripts/esc/types/esc_command_argument_descriptor.gd +++ b/addons/escoria-core/game/core-scripts/esc/types/esc_command_argument_descriptor.gd @@ -72,6 +72,10 @@ func validate(command: String, arguments: Array) -> bool: ] ) + # We also validate the arguments as they'll appear being passed in to the + # command in question, including any default values. + arguments = self.prepare_arguments(arguments) + for index in range(arguments.size()): if arguments[index] == null: # No type checking for null values