77#include " core/config/project_settings.h"
88#include " core/io/resource_loader.h"
99#include " core/object/script_language.h"
10- #include " editor/editor_node.h"
1110#include " entity.h"
1211#include " shared_component_resource.h"
12+ #ifdef TOOLS_ENABLED
13+ #include " editor/editor_node.h"
14+ #endif
1315
1416void System::_bind_methods () {
1517 ClassDB::bind_method (D_METHOD (" execute_in" , " phase" , " dispatcher" ), &System::execute_in, DEFVAL (godex::SYSTEM_NONE));
@@ -113,13 +115,13 @@ void System::prepare(godex::DynamicSystemExecutionData *p_info) {
113115
114116String System::validate_script (Ref<Script> p_script) {
115117 if (p_script.is_null ()) {
116- return TTR (" Script is null." );
118+ return RTR (" Script is null." );
117119 }
118120 if (p_script->is_valid () == false ) {
119- return TTR (" Script has some errors." );
121+ return RTR (" Script has some errors." );
120122 }
121123 if (" System" != p_script->get_instance_base_type ()) {
122- return TTR (" This script is not extending `System`." );
124+ return RTR (" This script is not extending `System`." );
123125 }
124126 List<MethodInfo> methods;
125127 p_script->get_script_method_list (&methods);
@@ -135,22 +137,25 @@ String System::validate_script(Ref<Script> p_script) {
135137 }
136138 }
137139 if (has_prepare == false ) {
138- return TTR (" This script is not overriding the function `_prepare()`." );
140+ return RTR (" This script is not overriding the function `_prepare()`." );
139141 }
140142 if (has_execute == false ) {
141- return TTR (" This script is not overriding the function `_execute(...)`." );
143+ return RTR (" This script is not overriding the function `_execute(...)`." );
142144 }
143145
144146 List<PropertyInfo> properties;
147+
148+ #ifdef TOOLS_ENABLED
145149 p_script->get_script_property_list (&properties);
146150 for (List<PropertyInfo>::Element *e = properties.front (); e; e = e->next ()) {
147151 if (e->get ().name == p_script->get_class_category ().name ) {
148152 properties.erase (e);
149153 }
150154 }
155+ #endif
151156
152157 if (properties.size ()) {
153- return TTR (" The System script can't have any property in it. It possible to only access `Component`s and `Databag`s." );
158+ return RTR (" The System script can't have any property in it. It possible to only access `Component`s and `Databag`s." );
154159 }
155160
156161 // This script is safe to use.
@@ -247,13 +252,13 @@ void SystemBundle::execute_after(uint32_t p_system_id) {
247252
248253String SystemBundle::validate_script (Ref<Script> p_script) {
249254 if (p_script.is_null ()) {
250- return TTR (" Script is null." );
255+ return RTR (" Script is null." );
251256 }
252257 if (p_script->is_valid () == false ) {
253- return TTR (" Script has some errors." );
258+ return RTR (" Script has some errors." );
254259 }
255260 if (" SystemBundle" != p_script->get_instance_base_type ()) {
256- return TTR (" This script is not extending `SystemBundle`." );
261+ return RTR (" This script is not extending `SystemBundle`." );
257262 }
258263 List<MethodInfo> methods;
259264 p_script->get_script_method_list (&methods);
@@ -265,7 +270,7 @@ String SystemBundle::validate_script(Ref<Script> p_script) {
265270 }
266271 }
267272 if (has_prepare == false ) {
268- return TTR (" This script is not overriding the function `_prepare()`." );
273+ return RTR (" This script is not overriding the function `_prepare()`." );
269274 }
270275 // This script is safe to use.
271276 return " " ;
@@ -314,13 +319,13 @@ Vector<StringName> Component::get_spawners() {
314319
315320String Component::validate_script (Ref<Script> p_script) {
316321 if (p_script.is_null ()) {
317- return TTR (" Script is null." );
322+ return RTR (" Script is null." );
318323 }
319324 if (p_script->is_valid () == false ) {
320- return TTR (" Script has some errors." );
325+ return RTR (" Script has some errors." );
321326 }
322327 if (" Component" != p_script->get_instance_base_type ()) {
323- return TTR (" This script is not extending `Component`." );
328+ return RTR (" This script is not extending `Component`." );
324329 }
325330
326331 // Make sure doesn't have any function in it.
@@ -331,29 +336,31 @@ String Component::validate_script(Ref<Script> p_script) {
331336 for (int i = 0 ; i < methods.size (); i += 1 ) {
332337 // Only this method is allowed.
333338 if (methods[i].name != " @implicit_new" && methods[i].name != " get_spawners" ) {
334- return TTR (" The only method the Component can have is the `get_spawners()`." );
339+ return RTR (" The only method the Component can have is the `get_spawners()`." );
335340 }
336341 }
337342
338343 List<PropertyInfo> properties;
339344 p_script->get_script_property_list (&properties);
340345 for (List<PropertyInfo>::Element *e = properties.front (); e; e = e->next ()) {
346+ #ifdef TOOLS_ENABLED
341347 if (
342348 // Filter GDScript file name
343349 e->get ().name == p_script->get_class_category ().name
344350 // Filter C# file name. It uses only the class name
345351 || p_script->get_path ().ends_with (e->get ().name + " .cs" )) {
346352 continue ;
347353 }
354+ #endif
348355 switch (e->get ().type ) {
349356 case Variant::NIL:
350- return " (" + e->get ().name + " ) " + TTR (" Please make sure all variables are typed." );
357+ return " (" + e->get ().name + " ) " + RTR (" Please make sure all variables are typed." );
351358 case Variant::RID:
352359 case Variant::OBJECT:
353- return " (" + e->get ().name + " ) " + TTR (" The Component can't hold unsafe references. The same reference could be holded by multiple things into the engine, this invalidates the thread safety of the ECS model. Please use a Databag or report your use case so a safe native type will be provided instead." );
360+ return " (" + e->get ().name + " ) " + RTR (" The Component can't hold unsafe references. The same reference could be holded by multiple things into the engine, this invalidates the thread safety of the ECS model. Please use a Databag or report your use case so a safe native type will be provided instead." );
354361 case Variant::SIGNAL:
355362 case Variant::CALLABLE:
356- return " (" + e->get ().name + " ) " + TTR (" The Component can't hold signals or callables. Please report your use case." );
363+ return " (" + e->get ().name + " ) " + RTR (" The Component can't hold signals or callables. Please report your use case." );
357364 default :
358365 // Nothing to worry about.
359366 break ;
0 commit comments