diff options
Diffstat (limited to 'Archipelago/player.gd')
-rw-r--r-- | Archipelago/player.gd | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Archipelago/player.gd b/Archipelago/player.gd index 87d9d0c..49d907d 100644 --- a/Archipelago/player.gd +++ b/Archipelago/player.gd | |||
@@ -1,6 +1,34 @@ | |||
1 | extends "res://scripts/player.gd" | 1 | extends "res://scripts/player.gd" |
2 | 2 | ||
3 | 3 | ||
4 | var _oldpos = Vector3(0, -200, 0) | ||
5 | |||
6 | |||
7 | func _ready(): | ||
8 | _oldpos = translation | ||
9 | _oldpos.y = 0 | ||
10 | |||
11 | var apclient = global.get_node("Archipelago") | ||
12 | if apclient.track_player: | ||
13 | var tracking_timer = Timer.new() | ||
14 | tracking_timer.name = "TrackingTimer" | ||
15 | tracking_timer.wait_time = 5.0 | ||
16 | add_child(tracking_timer) | ||
17 | tracking_timer.connect("timeout", self, "_tick_tracking") | ||
18 | tracking_timer.start() | ||
19 | |||
20 | |||
21 | func _tick_tracking(): | ||
22 | var newpos = translation | ||
23 | newpos.y = 0 | ||
24 | |||
25 | if newpos != _oldpos && newpos.distance_to(_oldpos) > 10: | ||
26 | _oldpos = newpos | ||
27 | |||
28 | var apclient = global.get_node("Archipelago") | ||
29 | apclient.setValue("PlayerPos", {"x": int(_oldpos.x), "z": int(_oldpos.z)}) | ||
30 | |||
31 | |||
4 | func _solving(): | 32 | func _solving(): |
5 | ._solving() | 33 | ._solving() |
6 | 34 | ||