blob: 6638329986d2dfa5b42a112dc2663618613ff0ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
extends "res://scripts/player.gd"
var _oldpos = Vector3(0, -200, 0)
var _oldpos_fine = Vector3(0, -200, 0)
func _ready():
_oldpos = translation
_oldpos.y = 0
_oldpos_fine = translation
_oldpos_fine.y = 0
var apclient = global.get_node("Archipelago")
if apclient.track_player:
var tracking_timer = Timer.new()
tracking_timer.name = "TrackingTimer"
tracking_timer.wait_time = 5.0
add_child(tracking_timer)
tracking_timer.connect("timeout", self, "_tick_tracking")
tracking_timer.start()
var tracking_timer_fine = Timer.new()
tracking_timer_fine.name = "TrackingTimerFine"
tracking_timer_fine.wait_time = 0.5
add_child(tracking_timer_fine)
tracking_timer_fine.connect("timeout", self, "_tick_tracking_fine")
tracking_timer_fine.start()
func _tick_tracking():
var tracker = get_tree().get_root().get_node("Spatial/AP_Tracker")
if tracker.has_connection():
return
var newpos = translation
newpos.y = 0
if newpos != _oldpos && newpos.distance_to(_oldpos) > 10:
_oldpos = newpos
var apclient = global.get_node("Archipelago")
apclient.setValue("PlayerPos", {"x": int(_oldpos.x), "z": int(_oldpos.z)})
func _tick_tracking_fine():
var tracker = get_tree().get_root().get_node("Spatial/AP_Tracker")
if !tracker.has_connection():
return
var newpos = translation
newpos.y = 0
if newpos != _oldpos_fine && newpos.distance_to(_oldpos_fine) > 0.5:
_oldpos_fine = newpos
tracker.update_position(int(_oldpos_fine.x), int(_oldpos_fine.z))
func _solving():
._solving()
var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
effects_node.enter_solve_mode()
func _solvingEnd():
._solvingEnd()
var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
effects_node.exit_solve_mode()
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.scancode == KEY_P:
var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
effects_node.skip_puzzle()
|