-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSimpleThings.gd
43 lines (35 loc) · 1.18 KB
/
SimpleThings.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
extends Node2D
var debug_print
var save_to_file: bool = true
var file_handler: FileAccess
var to_print: String = ""
var number: int = 0
func _ready():
HelpFunctions.initialize_list_of_available_classes()
func _process(delta):
if save_to_file:
file_handler = FileAccess.open("results.txt", FileAccess.WRITE)
for name_of_class in BasicData.base_classes:
for i in range(10):
number += 1
to_print = "########### " + name_of_class + "\n"
to_print += "\tvar thing" + str(number) + ' = ClassDB.instantiate("' + name_of_class + '")\n'
to_print += "\tstr(thing" + str(number) + ")"
if save_to_file:
file_handler.store_string(to_print + "\n")
print(to_print)
var thing = ClassDB.instantiate(name_of_class)
str(thing)
if thing is Node:
to_print = "\tadd_child(thing" + str(number) + ")\n"
to_print += "\tthing" + str(number) + ".queue_free()"
if save_to_file:
file_handler.store_string(to_print + "\n")
print(to_print)
thing.queue_free()
elif thing is Object && !(thing is RefCounted):
to_print = "\tthing" + str(number) + ".free()"
if save_to_file:
file_handler.store_string(to_print + "\n")
print(to_print)
thing.free()