about summary refs log tree commit diff stats
path: root/Archipelago/player.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-03 14:31:51 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-03 14:31:51 -0400
commit38175bd12c1a0a2c80be5f4011f69e4659f61ccd (patch)
tree6e110740dfeaf024c7bf4c46b0eb3cd18bdf4876 /Archipelago/player.gd
parent0b1ea0dbc89b231d2b4847d0fb7dc5b23e060b0c (diff)
downloadlingo-archipelago-38175bd12c1a0a2c80be5f4011f69e4659f61ccd.tar.gz
lingo-archipelago-38175bd12c1a0a2c80be5f4011f69e4659f61ccd.tar.bz2
lingo-archipelago-38175bd12c1a0a2c80be5f4011f69e4659f61ccd.zip
Added player position tracking
Diffstat (limited to 'Archipelago/player.gd')
-rw-r--r--Archipelago/player.gd28
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 @@
1extends "res://scripts/player.gd" 1extends "res://scripts/player.gd"
2 2
3 3
4var _oldpos = Vector3(0, -200, 0)
5
6
7func _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
21func _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
4func _solving(): 32func _solving():
5 ._solving() 33 ._solving()
6 34