فهرست منبع

Tweak the error message when trying to run an invalid script from CLI

(cherry picked from commit 2ab9515b0750b18717196e56ca63dae410e0f61f)
Hugo Locurcio 5 سال پیش
والد
کامیت
25b353fd32
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      main/main.cpp

+ 2 - 2
main/main.cpp

@@ -1582,7 +1582,7 @@ bool Main::start() {
 			return false;
 			return false;
 		}
 		}
 
 
-		if (script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) {
+		if (script_res->can_instance()) {
 
 
 			StringName instance_type = script_res->get_instance_base_type();
 			StringName instance_type = script_res->get_instance_base_type();
 			Object *obj = ClassDB::instance(instance_type);
 			Object *obj = ClassDB::instance(instance_type);
@@ -1590,7 +1590,7 @@ bool Main::start() {
 			if (!script_loop) {
 			if (!script_loop) {
 				if (obj)
 				if (obj)
 					memdelete(obj);
 					memdelete(obj);
-				ERR_FAIL_V_MSG(false, "Can't load script '" + script + "', it does not inherit from a MainLoop type.");
+				ERR_FAIL_V_MSG(false, vformat("Can't load the script \"%s\" as it doesn't inherit from SceneTree or MainLoop.", script));
 			}
 			}
 
 
 			script_loop->set_init_script(script_res);
 			script_loop->set_init_script(script_res);