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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
extends "res://scripts/load.gd"
func _load():
global._print("Hooked Load Start")
disable_saving = true
var player = get_node("player")
player.playable = false
var blindfold = ColorRect.new()
blindfold.color = Color.black
blindfold.name = "blindfold"
blindfold.anchor_right = Control.ANCHOR_END
blindfold.anchor_bottom = Control.ANCHOR_END
add_child(blindfold)
var race_manager = global.get_node("RaceManager")
var multiplayer = race_manager.SCRIPT_multiplayer.new()
multiplayer.name = "Multiplayer"
multiplayer.active_lobby_id = race_manager.lobby_id
add_child(multiplayer)
var label = Label.new()
label.set_name("label")
label.margin_right = 1920.0 - 20.0
label.margin_top = 20.0
label.align = Label.ALIGN_RIGHT
label.valign = Label.VALIGN_TOP
var timer_label = Label.new()
timer_label.set_name("timer_label")
timer_label.margin_left = 20.0
timer_label.margin_top = 20.0
timer_label.align = Label.ALIGN_LEFT
timer_label.valign = Label.VALIGN_TOP
var dynamic_font = DynamicFont.new()
dynamic_font.font_data = load("res://fonts/Lingo.ttf")
dynamic_font.size = 36
dynamic_font.outline_color = Color(0, 0, 0, 1)
dynamic_font.outline_size = 2
label.add_font_override("font", dynamic_font)
timer_label.add_font_override("font", dynamic_font)
add_child(label)
add_child(timer_label)
var panel_script = load("res://nodes/panel_1.tscn")
var victory_panel = panel_script.instance()
victory_panel.name = "Victory"
victory_panel.text = "i win"
victory_panel.answer = "i win"
victory_panel.translation.x = race_manager.end_pos["pos"][0] + 0.5
victory_panel.translation.y = race_manager.end_pos["pos"][1] + 1.5
victory_panel.translation.z = race_manager.end_pos["pos"][2] + 0.01
add_child(victory_panel)
victory_panel.get_node("Viewport/GUI/Panel/TextEdit").connect("answer_correct", self, "victory")
set_gridmap_tile(
race_manager.end_pos["pos"][0],
race_manager.end_pos["pos"][1] + 1.5,
race_manager.end_pos["pos"][2] - 0.5,
"MeshInstance5"
)
var timer = Timer.new()
timer.name = "Timer"
timer.set_wait_time(0.03)
timer.set_one_shot(false)
timer.connect("timeout", self, "bump_timer")
add_child(timer)
global._print("Hooked Load Stop")
._load()
global._print("MP Loaded")
multiplayer.player_loaded()
func victory():
get_node("Timer").stop()
get_node("Multiplayer").player_victory()
ingame_achieve("Victory!")
func set_gridmap_tile(x, y, z, tile):
var gridmap = self.get_node("GridMap")
var mesh_library = gridmap.mesh_library
var mapvec = gridmap.world_to_map(gridmap.to_local(Vector3(x, y, z)))
gridmap.set_cell_item(mapvec.x, mapvec.y, mapvec.z, mesh_library.find_item_by_name(tile))
func bump_timer():
var race_manager = global.get_node("RaceManager")
var elapsed = float(Time.get_ticks_msec() - race_manager.started_time) / 1000.0
get_node("timer_label").text = (
"%d:%02d:%05.2f" % [int(elapsed) / 60 / 60, int(elapsed) / 60 % 60, fmod(elapsed, 60.0)]
)
|