Format files using updated file_format.sh

This commit is contained in:
Aaron Franke
2020-10-01 14:23:54 -04:00
parent fe9fd7d7e4
commit 918a289ee2
79 changed files with 512 additions and 512 deletions

View File

@@ -14,10 +14,10 @@ func start_timer(timeout):
_timer.connect("timeout", self, "_on_timer_done")
else:
cancel_timer()
_timer.start(timeout)
_timer_started = true
return _timer

View File

@@ -19,12 +19,12 @@ func _ready():
yield(start_timer(0.5), "timeout")
if is_timer_canceled():
return
while $DynamicShapes.get_child_count():
var type_node = $DynamicShapes.get_child(0)
_object_templates.push_back(type_node)
$DynamicShapes.remove_child(type_node)
$Options.add_menu_item(OPTION_TYPE_ALL)
$Options.add_menu_item(OPTION_TYPE_BOX)
$Options.add_menu_item(OPTION_TYPE_CAPSULE)
@@ -32,15 +32,15 @@ func _ready():
$Options.add_menu_item(OPTION_TYPE_CONVEX)
$Options.add_menu_item(OPTION_TYPE_SPHERE)
$Options.connect("option_selected", self, "_on_option_selected")
_start_all_types()
func _on_option_selected(option):
cancel_timer()
_despawn_objects()
match option:
OPTION_TYPE_ALL:
_start_all_types()
@@ -61,7 +61,7 @@ func _find_type_index(type_name):
var type_node = _object_templates[type_index]
if type_node.name.find(type_name) > -1:
return type_index
Log.print_error("Invalid shape type: " + type_name)
return -1
@@ -71,25 +71,25 @@ func _start_type(type_index):
return
if type_index >= _object_templates.size():
return
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_spawn_objects(type_index)
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_activate_objects()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_despawn_objects()
Log.print_log("* Done.")
@@ -98,21 +98,21 @@ func _start_all_types():
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_spawn_objects(type_index)
yield(start_timer(1.0), "timeout")
if is_timer_canceled():
return
_activate_objects()
yield(start_timer(5.0), "timeout")
if is_timer_canceled():
return
_despawn_objects()
Log.print_log("* Done.")
@@ -120,9 +120,9 @@ func _spawn_objects(type_index):
var template_node = _object_templates[type_index]
for spawn in spawns:
var spawn_parent = get_node(spawn)
Log.print_log("* Spawning: " + template_node.name)
for _index in range(spawn_multipiler):
for _node_index in spawn_count / spawn_multipiler:
var node = template_node.duplicate() as Spatial
@@ -131,9 +131,9 @@ func _spawn_objects(type_index):
func _activate_objects():
var spawn_parent = $SpawnTarget1
Log.print_log("* Activating")
for node_index in spawn_parent.get_child_count():
var node = spawn_parent.get_child(node_index) as RigidBody
node.set_sleeping(false)
@@ -142,12 +142,12 @@ func _activate_objects():
func _despawn_objects():
for spawn in spawns:
var spawn_parent = get_node(spawn)
if spawn_parent.get_child_count() == 0:
return
Log.print_log("* Despawning")
while spawn_parent.get_child_count():
var node_index = spawn_parent.get_child_count() - 1
var node = spawn_parent.get_child(node_index)

View File

@@ -27,7 +27,7 @@ func add_test(id, scene_path):
test_data.id = id
test_data.scene_path = scene_path
_test_list.append(test_data)
add_menu_item(id)
@@ -39,15 +39,15 @@ func _on_option_selected(item_path):
func _start_test(test):
_current_test = test
if _current_test_scene:
_current_test_scene.queue_free()
_current_test_scene = null
Log.print_log("*** STARTING TEST: " + test.id)
var scene = load(test.scene_path)
_current_test_scene = scene.instance()
get_tree().root.add_child(_current_test_scene)
var label_test = get_node("../LabelTest")
label_test.test_name = test.id

View File

@@ -17,10 +17,10 @@ func _unhandled_input(event):
if mouse_button_event.button_index == BUTTON_LEFT:
_rotation_enabled = mouse_button_event.pressed
return
if not _rotation_enabled:
return
var mouse_motion_event = event as InputEventMouseMotion
if mouse_motion_event:
var rotation_delta = mouse_motion_event.relative.x

View File

@@ -8,7 +8,7 @@ var _entry_template
func _enter_tree():
Log.connect("entry_logged", self, "_on_log_entry")
_entry_template = get_child(0) as Label
remove_child(_entry_template)
@@ -22,16 +22,16 @@ func clear():
func _on_log_entry(message, type):
var new_entry = _entry_template.duplicate() as Label
new_entry.set_text(message)
if type == Log.LogType.ERROR:
new_entry.modulate = Color.red
else:
new_entry.modulate = Color.white
if get_child_count() >= MAX_ENTRIES:
var first_entry = get_child(0) as Label
remove_child(first_entry)
first_entry.queue_free()
add_child(new_entry)

View File

@@ -15,16 +15,16 @@ func _ready():
func _process(_delta):
if _attachment == null:
return
var viewport = get_viewport()
if viewport == null:
return
var camera = viewport.get_camera()
if camera == null:
return
var world_pos = world_offset + _attachment.global_transform.origin
var screen_pos = camera.unproject_position(world_pos)
rect_position = _pos_offset + screen_pos - 0.5 * rect_size

View File

@@ -9,14 +9,14 @@ func add_menu_item(item_path):
var path_elements = item_path.split("/", false)
var path_element_count = path_elements.size()
assert(path_element_count > 0)
var path = ""
var popup = get_popup()
for element_index in path_element_count - 1:
var popup_label = path_elements[element_index]
path += popup_label + "/"
popup = _add_popup(popup, path, popup_label)
_add_item(popup, path_elements[path_element_count - 1])
@@ -30,15 +30,15 @@ func _add_popup(parent_popup, path, label):
var popup_menu = popup_node as PopupMenu
assert(popup_menu)
return popup_menu
var popup_menu = PopupMenu.new()
popup_menu.name = label
parent_popup.add_child(popup_menu)
parent_popup.add_submenu_item(label, label)
popup_menu.connect("index_pressed", self, "_on_item_pressed", [popup_menu, path])
return popup_menu

View File

@@ -12,7 +12,7 @@ var _engine = PhysicsEngine.OTHER
func _enter_tree():
get_tree().debug_collisions_hint = true
var engine_string = ProjectSettings.get_setting("physics/3d/physics_engine")
match engine_string:
"DEFAULT":
@@ -28,7 +28,7 @@ func _enter_tree():
func _process(_delta):
if Input.is_action_just_pressed("toggle_full_screen"):
OS.window_fullscreen = not OS.window_fullscreen
if Input.is_action_just_pressed("toggle_debug_collision"):
var debug_collision_enabled = not _is_debug_collision_enabled()
_set_debug_collision_enabled(debug_collision_enabled)
@@ -36,7 +36,7 @@ func _process(_delta):
Log.print_log("Debug Collision ON")
else:
Log.print_log("Debug Collision OFF")
if Input.is_action_just_pressed("exit"):
get_tree().quit()