diff --git a/arrow.gd b/arrow.gd index ee1636c..91dc287 100644 --- a/arrow.gd +++ b/arrow.gd @@ -8,12 +8,13 @@ func _ready(): pass func _process(delta): - var t = repository.objects[target] - #print(t) - $Line.points[1] = t.global_position - global_position - $Label.position = ($Line.points[0] + $Line.points[1])/2 - $Tip.position = ($Line.points[0] + $Line.points[1])/2 - $Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1]) + if repository.objects.has(target): + var t = repository.objects[target] + #print(t) + $Line.points[1] = t.global_position - global_position + $Label.position = ($Line.points[0] + $Line.points[1])/2 + $Tip.position = ($Line.points[0] + $Line.points[1])/2 + $Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1]) func label_set(new_label): label = new_label diff --git a/main.gd b/main.gd index 7c17922..13f20c1 100644 --- a/main.gd +++ b/main.gd @@ -16,6 +16,9 @@ func _ready(): server = TCP_Server.new() server.listen(1234) + # Load first level. + load_level(0) + func list_levels(): var levels = [] var dir = Directory.new() diff --git a/node.gd b/node.gd index af2b908..d992295 100644 --- a/node.gd +++ b/node.gd @@ -14,12 +14,13 @@ func _ready(): func _process(delta): for c in children.keys(): - var other = get_node("..").objects[c] - var d = other.position.distance_to(position) - var dir = (other.position - position).normalized() - var f = (d*0.05) - position += dir*f - other.position -= dir*f + if get_node("..").objects.has(c): + var other = get_node("..").objects[c] + var d = other.position.distance_to(position) + var dir = (other.position - position).normalized() + var f = (d*0.05) + position += dir*f + other.position -= dir*f func id_set(new_id): id = new_id diff --git a/repository.gd b/repository.gd index 5dfecc9..0867287 100644 --- a/repository.gd +++ b/repository.gd @@ -10,20 +10,20 @@ func _ready(): func _process(delta): if path: - update_everything() + apply_forces() func update_everything(): update_head() update_refs() update_index() update_objects() - apply_forces() func set_path(new_path): path = new_path for o in objects.values(): o.queue_free() objects = {} + update_everything() func get_path(): return path diff --git a/repository.tscn b/repository.tscn index 23c3be2..362af37 100644 --- a/repository.tscn +++ b/repository.tscn @@ -25,3 +25,14 @@ text = "Index:" __meta__ = { "_edit_use_anchors_": false } + +[node name="Button" type="Button" parent="."] +margin_left = 36.5602 +margin_top = 67.9891 +margin_right = 94.5602 +margin_bottom = 109.989 +text = "Update" +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="Button" to="." method="update_everything"] diff --git a/terminal.gd b/terminal.gd index b55518c..a5ea6b7 100644 --- a/terminal.gd +++ b/terminal.gd @@ -12,3 +12,4 @@ func run_command_in_a_thread(command): $Input.text = "" $Output.text = $Output.text + "$ " + command + "\n" + output $Output.scroll_vertical = 999999 + $"../ActiveRepository".update_everything()