Only update graph when hitting button or sending command, for now

This commit is contained in:
Sebastian Morr 2020-09-01 19:32:33 +02:00
parent 2a0e2e46bb
commit 5161a8563e
6 changed files with 31 additions and 14 deletions

View file

@ -8,12 +8,13 @@ func _ready():
pass pass
func _process(delta): func _process(delta):
var t = repository.objects[target] if repository.objects.has(target):
#print(t) var t = repository.objects[target]
$Line.points[1] = t.global_position - global_position #print(t)
$Label.position = ($Line.points[0] + $Line.points[1])/2 $Line.points[1] = t.global_position - global_position
$Tip.position = ($Line.points[0] + $Line.points[1])/2 $Label.position = ($Line.points[0] + $Line.points[1])/2
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1]) $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): func label_set(new_label):
label = new_label label = new_label

View file

@ -16,6 +16,9 @@ func _ready():
server = TCP_Server.new() server = TCP_Server.new()
server.listen(1234) server.listen(1234)
# Load first level.
load_level(0)
func list_levels(): func list_levels():
var levels = [] var levels = []
var dir = Directory.new() var dir = Directory.new()

13
node.gd
View file

@ -14,12 +14,13 @@ func _ready():
func _process(delta): func _process(delta):
for c in children.keys(): for c in children.keys():
var other = get_node("..").objects[c] if get_node("..").objects.has(c):
var d = other.position.distance_to(position) var other = get_node("..").objects[c]
var dir = (other.position - position).normalized() var d = other.position.distance_to(position)
var f = (d*0.05) var dir = (other.position - position).normalized()
position += dir*f var f = (d*0.05)
other.position -= dir*f position += dir*f
other.position -= dir*f
func id_set(new_id): func id_set(new_id):
id = new_id id = new_id

View file

@ -10,20 +10,20 @@ func _ready():
func _process(delta): func _process(delta):
if path: if path:
update_everything() apply_forces()
func update_everything(): func update_everything():
update_head() update_head()
update_refs() update_refs()
update_index() update_index()
update_objects() update_objects()
apply_forces()
func set_path(new_path): func set_path(new_path):
path = new_path path = new_path
for o in objects.values(): for o in objects.values():
o.queue_free() o.queue_free()
objects = {} objects = {}
update_everything()
func get_path(): func get_path():
return path return path

View file

@ -25,3 +25,14 @@ text = "Index:"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_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"]

View file

@ -12,3 +12,4 @@ func run_command_in_a_thread(command):
$Input.text = "" $Input.text = ""
$Output.text = $Output.text + "$ " + command + "\n" + output $Output.text = $Output.text + "$ " + command + "\n" + output
$Output.scroll_vertical = 999999 $Output.scroll_vertical = 999999
$"../ActiveRepository".update_everything()