diff options
Diffstat (limited to 'apworld/client')
-rw-r--r-- | apworld/client/assets/goal.png | bin | 0 -> 215 bytes | |||
-rw-r--r-- | apworld/client/client.gd | 4 | ||||
-rw-r--r-- | apworld/client/gamedata.gd | 5 | ||||
-rw-r--r-- | apworld/client/manager.gd | 16 | ||||
-rw-r--r-- | apworld/client/player.gd | 22 | ||||
-rw-r--r-- | apworld/client/textclient.gd | 15 |
6 files changed, 42 insertions, 20 deletions
diff --git a/apworld/client/assets/goal.png b/apworld/client/assets/goal.png new file mode 100644 index 0000000..bd1650d --- /dev/null +++ b/apworld/client/assets/goal.png | |||
Binary files differ | |||
diff --git a/apworld/client/client.gd b/apworld/client/client.gd index a23e85a..62d7fd8 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd | |||
@@ -24,6 +24,7 @@ var _received_items = {} | |||
24 | var _slot_data = {} | 24 | var _slot_data = {} |
25 | var _accessible_locations = [] | 25 | var _accessible_locations = [] |
26 | var _accessible_worldports = [] | 26 | var _accessible_worldports = [] |
27 | var _goal_accessible = false | ||
27 | 28 | ||
28 | signal could_not_connect | 29 | signal could_not_connect |
29 | signal connect_status | 30 | signal connect_status |
@@ -61,6 +62,7 @@ func _reset_state(): | |||
61 | _checked_worldports = [] | 62 | _checked_worldports = [] |
62 | _accessible_locations = [] | 63 | _accessible_locations = [] |
63 | _accessible_worldports = [] | 64 | _accessible_worldports = [] |
65 | _goal_accessible = false | ||
64 | 66 | ||
65 | 67 | ||
66 | func disconnect_from_ap(): | 68 | func disconnect_from_ap(): |
@@ -174,6 +176,8 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo | |||
174 | for port_id in message["worldports"]: | 176 | for port_id in message["worldports"]: |
175 | _accessible_worldports.append(int(port_id)) | 177 | _accessible_worldports.append(int(port_id)) |
176 | 178 | ||
179 | _goal_accessible = bool(message.get("goal", false)) | ||
180 | |||
177 | accessible_locations_updated.emit() | 181 | accessible_locations_updated.emit() |
178 | 182 | ||
179 | elif cmd == "UpdateKeyboard": | 183 | elif cmd == "UpdateKeyboard": |
diff --git a/apworld/client/gamedata.gd b/apworld/client/gamedata.gd index 1424721..334d42a 100644 --- a/apworld/client/gamedata.gd +++ b/apworld/client/gamedata.gd | |||
@@ -14,6 +14,7 @@ var letter_id_by_ap_id = {} | |||
14 | var symbol_item_ids = [] | 14 | var symbol_item_ids = [] |
15 | var anti_trap_ids = {} | 15 | var anti_trap_ids = {} |
16 | var location_name_by_id = {} | 16 | var location_name_by_id = {} |
17 | var ending_display_name_by_name = {} | ||
17 | 18 | ||
18 | var kSYMBOL_ITEMS | 19 | var kSYMBOL_ITEMS |
19 | 20 | ||
@@ -103,7 +104,9 @@ func load(data_bytes): | |||
103 | location_name_by_id[mastery.get_ap_id()] = _get_mastery_location_name(mastery) | 104 | location_name_by_id[mastery.get_ap_id()] = _get_mastery_location_name(mastery) |
104 | 105 | ||
105 | for ending in objects.get_endings(): | 106 | for ending in objects.get_endings(): |
106 | location_name_by_id[ending.get_ap_id()] = _get_ending_location_name(ending) | 107 | var location_name = _get_ending_location_name(ending) |
108 | location_name_by_id[ending.get_ap_id()] = location_name | ||
109 | ending_display_name_by_name[ending.get_name()] = location_name | ||
107 | 110 | ||
108 | for keyholder in objects.get_keyholders(): | 111 | for keyholder in objects.get_keyholders(): |
109 | if keyholder.has_key(): | 112 | if keyholder.has_key(): |
diff --git a/apworld/client/manager.gd b/apworld/client/manager.gd index 5b731d2..b4fef1c 100644 --- a/apworld/client/manager.gd +++ b/apworld/client/manager.gd | |||
@@ -45,6 +45,22 @@ const kCYAN_DOOR_BEHAVIOR_H2 = 0 | |||
45 | const kCYAN_DOOR_BEHAVIOR_DOUBLE_LETTER = 1 | 45 | const kCYAN_DOOR_BEHAVIOR_DOUBLE_LETTER = 1 |
46 | const kCYAN_DOOR_BEHAVIOR_ITEM = 2 | 46 | const kCYAN_DOOR_BEHAVIOR_ITEM = 2 |
47 | 47 | ||
48 | const kEndingNameByVictoryValue = { | ||
49 | 0: "GRAY", | ||
50 | 1: "PURPLE", | ||
51 | 2: "MINT", | ||
52 | 3: "BLACK", | ||
53 | 4: "BLUE", | ||
54 | 5: "CYAN", | ||
55 | 6: "RED", | ||
56 | 7: "PLUM", | ||
57 | 8: "ORANGE", | ||
58 | 9: "GOLD", | ||
59 | 10: "YELLOW", | ||
60 | 11: "GREEN", | ||
61 | 12: "WHITE", | ||
62 | } | ||
63 | |||
48 | var apworld_version = [0, 0] | 64 | var apworld_version = [0, 0] |
49 | var cyan_door_behavior = kCYAN_DOOR_BEHAVIOR_H2 | 65 | var cyan_door_behavior = kCYAN_DOOR_BEHAVIOR_H2 |
50 | var daedalus_roof_access = false | 66 | var daedalus_roof_access = false |
diff --git a/apworld/client/player.gd b/apworld/client/player.gd index 366c3b0..5417a48 100644 --- a/apworld/client/player.gd +++ b/apworld/client/player.gd | |||
@@ -1,21 +1,5 @@ | |||
1 | extends "res://scripts/nodes/player.gd" | 1 | extends "res://scripts/nodes/player.gd" |
2 | 2 | ||
3 | const kEndingNameByVictoryValue = { | ||
4 | 0: "GRAY", | ||
5 | 1: "PURPLE", | ||
6 | 2: "MINT", | ||
7 | 3: "BLACK", | ||
8 | 4: "BLUE", | ||
9 | 5: "CYAN", | ||
10 | 6: "RED", | ||
11 | 7: "PLUM", | ||
12 | 8: "ORANGE", | ||
13 | 9: "GOLD", | ||
14 | 10: "YELLOW", | ||
15 | 11: "GREEN", | ||
16 | 12: "WHITE", | ||
17 | } | ||
18 | |||
19 | signal evaluate_solvability | 3 | signal evaluate_solvability |
20 | 4 | ||
21 | var compass | 5 | var compass |
@@ -138,7 +122,7 @@ func _ready(): | |||
138 | 122 | ||
139 | get_parent().add_child.call_deferred(locationListener) | 123 | get_parent().add_child.call_deferred(locationListener) |
140 | 124 | ||
141 | if kEndingNameByVictoryValue.get(ap.victory_condition, null) == ending.get_name(): | 125 | if ap.kEndingNameByVictoryValue.get(ap.victory_condition, null) == ending.get_name(): |
142 | var victoryListener = ap.SCRIPT_victoryListener.new() | 126 | var victoryListener = ap.SCRIPT_victoryListener.new() |
143 | victoryListener.name = "victoryListener" | 127 | victoryListener.name = "victoryListener" |
144 | victoryListener.senders.append(NodePath("/root/scene/" + ending.get_path())) | 128 | victoryListener.senders.append(NodePath("/root/scene/" + ending.get_path())) |
@@ -216,9 +200,9 @@ func _ready(): | |||
216 | 200 | ||
217 | var sign2 = sign_prefab.instantiate() | 201 | var sign2 = sign_prefab.instantiate() |
218 | sign2.position = Vector3(-7, 4, -15.01) | 202 | sign2.position = Vector3(-7, 4, -15.01) |
219 | sign2.text = "%s ending" % kEndingNameByVictoryValue.get(ap.victory_condition, "?") | 203 | sign2.text = "%s ending" % ap.kEndingNameByVictoryValue.get(ap.victory_condition, "?") |
220 | 204 | ||
221 | var sign2_color = kEndingNameByVictoryValue.get(ap.victory_condition, "coral").to_lower() | 205 | var sign2_color = ap.kEndingNameByVictoryValue.get(ap.victory_condition, "coral").to_lower() |
222 | if sign2_color == "white": | 206 | if sign2_color == "white": |
223 | sign2_color = "silver" | 207 | sign2_color = "silver" |
224 | 208 | ||
diff --git a/apworld/client/textclient.gd b/apworld/client/textclient.gd index 0c4e675..530eddb 100644 --- a/apworld/client/textclient.gd +++ b/apworld/client/textclient.gd | |||
@@ -10,6 +10,7 @@ var is_open = false | |||
10 | var locations_overlay | 10 | var locations_overlay |
11 | var location_texture | 11 | var location_texture |
12 | var worldport_texture | 12 | var worldport_texture |
13 | var goal_texture | ||
13 | 14 | ||
14 | var worldports_tab | 15 | var worldports_tab |
15 | var worldports_tree | 16 | var worldports_tree |
@@ -116,6 +117,10 @@ func _ready(): | |||
116 | worldport_image.load_png_from_buffer(runtime.read_path("assets/worldport.png")) | 117 | worldport_image.load_png_from_buffer(runtime.read_path("assets/worldport.png")) |
117 | worldport_texture = ImageTexture.create_from_image(worldport_image) | 118 | worldport_texture = ImageTexture.create_from_image(worldport_image) |
118 | 119 | ||
120 | var goal_image = Image.new() | ||
121 | goal_image.load_png_from_buffer(runtime.read_path("assets/goal.png")) | ||
122 | goal_texture = ImageTexture.create_from_image(goal_image) | ||
123 | |||
119 | 124 | ||
120 | func _input(event): | 125 | func _input(event): |
121 | if global.loaded and event is InputEventKey and event.pressed: | 126 | if global.loaded and event is InputEventKey and event.pressed: |
@@ -179,6 +184,7 @@ func update_locations(): | |||
179 | 184 | ||
180 | const kLocation = 0 | 185 | const kLocation = 0 |
181 | const kWorldport = 1 | 186 | const kWorldport = 1 |
187 | const kGoal = 2 | ||
182 | 188 | ||
183 | var location_names = [] | 189 | var location_names = [] |
184 | var type_by_name = {} | 190 | var type_by_name = {} |
@@ -196,6 +202,13 @@ func update_locations(): | |||
196 | 202 | ||
197 | location_names.sort() | 203 | location_names.sort() |
198 | 204 | ||
205 | if ap.client._goal_accessible: | ||
206 | var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[ | ||
207 | ap.victory_condition | ||
208 | ]] | ||
209 | location_names.push_front(location_name) | ||
210 | type_by_name[location_name] = kGoal | ||
211 | |||
199 | var count = 0 | 212 | var count = 0 |
200 | for location_name in location_names: | 213 | for location_name in location_names: |
201 | tracker_label.append_text("[p]%s[/p]" % location_name) | 214 | tracker_label.append_text("[p]%s[/p]" % location_name) |
@@ -207,6 +220,8 @@ func update_locations(): | |||
207 | locations_overlay.add_image(location_texture) | 220 | locations_overlay.add_image(location_texture) |
208 | elif type_by_name[location_name] == kWorldport: | 221 | elif type_by_name[location_name] == kWorldport: |
209 | locations_overlay.add_image(worldport_texture) | 222 | locations_overlay.add_image(worldport_texture) |
223 | elif type_by_name[location_name] == kGoal: | ||
224 | locations_overlay.add_image(goal_texture) | ||
210 | locations_overlay.pop() | 225 | locations_overlay.pop() |
211 | count += 1 | 226 | count += 1 |
212 | 227 | ||