diff options
Diffstat (limited to 'client/Archipelago/player.gd')
| -rw-r--r-- | client/Archipelago/player.gd | 148 |
1 files changed, 145 insertions, 3 deletions
| diff --git a/client/Archipelago/player.gd b/client/Archipelago/player.gd index 4b995bc..538830f 100644 --- a/client/Archipelago/player.gd +++ b/client/Archipelago/player.gd | |||
| @@ -18,6 +18,8 @@ const kEndingNameByVictoryValue = { | |||
| 18 | 18 | ||
| 19 | signal evaluate_solvability | 19 | signal evaluate_solvability |
| 20 | 20 | ||
| 21 | var compass | ||
| 22 | |||
| 21 | 23 | ||
| 22 | func _ready(): | 24 | func _ready(): |
| 23 | var khl_script = load("res://scripts/nodes/keyHolderListener.gd") | 25 | var khl_script = load("res://scripts/nodes/keyHolderListener.gd") |
| @@ -25,6 +27,9 @@ func _ready(): | |||
| 25 | var ap = global.get_node("Archipelago") | 27 | var ap = global.get_node("Archipelago") |
| 26 | var gamedata = global.get_node("Gamedata") | 28 | var gamedata = global.get_node("Gamedata") |
| 27 | 29 | ||
| 30 | compass = global.get_node("Compass") | ||
| 31 | compass.visible = ap.show_compass | ||
| 32 | |||
| 28 | ap.start_batching_locations() | 33 | ap.start_batching_locations() |
| 29 | 34 | ||
| 30 | # Set up door locations. | 35 | # Set up door locations. |
| @@ -36,7 +41,10 @@ func _ready(): | |||
| 36 | if not door.has_ap_id(): | 41 | if not door.has_ap_id(): |
| 37 | continue | 42 | continue |
| 38 | 43 | ||
| 39 | if door.get_type() == gamedata.SCRIPT_proto.DoorType.ITEM_ONLY: | 44 | if ( |
| 45 | door.get_type() == gamedata.SCRIPT_proto.DoorType.ITEM_ONLY | ||
| 46 | or door.get_type() == gamedata.SCRIPT_proto.DoorType.GALLERY_PAINTING | ||
| 47 | ): | ||
| 40 | continue | 48 | continue |
| 41 | 49 | ||
| 42 | var locationListener = ap.SCRIPT_locationListener.new() | 50 | var locationListener = ap.SCRIPT_locationListener.new() |
| @@ -68,6 +76,12 @@ func _ready(): | |||
| 68 | 76 | ||
| 69 | locationListener.senders.append(NodePath("../" + khl.name)) | 77 | locationListener.senders.append(NodePath("../" + khl.name)) |
| 70 | 78 | ||
| 79 | for sender in door.get_senders(): | ||
| 80 | locationListener.senders.append(NodePath("/root/scene/" + sender)) | ||
| 81 | |||
| 82 | if door.has_complete_at(): | ||
| 83 | locationListener.complete_at = door.get_complete_at() | ||
| 84 | |||
| 71 | get_parent().add_child.call_deferred(locationListener) | 85 | get_parent().add_child.call_deferred(locationListener) |
| 72 | 86 | ||
| 73 | # Set up letter locations. | 87 | # Set up letter locations. |
| @@ -88,7 +102,10 @@ func _ready(): | |||
| 88 | != ap.kLETTER_BEHAVIOR_VANILLA | 102 | != ap.kLETTER_BEHAVIOR_VANILLA |
| 89 | ): | 103 | ): |
| 90 | var scout = ap.scout_location(letter.get_ap_id()) | 104 | var scout = ap.scout_location(letter.get_ap_id()) |
| 91 | if scout != null: | 105 | if ( |
| 106 | scout != null | ||
| 107 | and not (scout["player"] == ap.client._slot and scout["flags"] & 4 != 0) | ||
| 108 | ): | ||
| 92 | var item_name = "Unknown" | 109 | var item_name = "Unknown" |
| 93 | var item_player_game = ap.client._game_by_player[float(scout["player"])] | 110 | var item_player_game = ap.client._game_by_player[float(scout["player"])] |
| 94 | if ap.client._item_id_to_name[item_player_game].has(scout["item"]): | 111 | if ap.client._item_id_to_name[item_player_game].has(scout["item"]): |
| @@ -190,11 +207,132 @@ func _ready(): | |||
| 190 | warp_enter.rotation_degrees.y = 90 | 207 | warp_enter.rotation_degrees.y = 90 |
| 191 | get_parent().add_child.call_deferred(warp_enter) | 208 | get_parent().add_child.call_deferred(warp_enter) |
| 192 | 209 | ||
| 193 | # Remove door behind X1. | ||
| 194 | if global.map == "the_entry": | 210 | if global.map == "the_entry": |
| 211 | # Remove door behind X1. | ||
| 195 | var door_node = get_tree().get_root().get_node("/root/scene/Components/Doors/exit_1") | 212 | var door_node = get_tree().get_root().get_node("/root/scene/Components/Doors/exit_1") |
| 196 | door_node.handleTriggered() | 213 | door_node.handleTriggered() |
| 197 | 214 | ||
| 215 | # Display win condition. | ||
| 216 | var sign_prefab = preload("res://objects/nodes/sign.tscn") | ||
| 217 | var sign1 = sign_prefab.instantiate() | ||
| 218 | sign1.position = Vector3(-7, 5, -15.01) | ||
| 219 | sign1.text = "victory" | ||
| 220 | get_parent().add_child.call_deferred(sign1) | ||
| 221 | |||
| 222 | var sign2 = sign_prefab.instantiate() | ||
| 223 | sign2.position = Vector3(-7, 4, -15.01) | ||
| 224 | sign2.text = "%s ending" % kEndingNameByVictoryValue.get(ap.victory_condition, "?") | ||
| 225 | |||
| 226 | var sign2_color = kEndingNameByVictoryValue.get(ap.victory_condition, "coral").to_lower() | ||
| 227 | if sign2_color == "white": | ||
| 228 | sign2_color = "silver" | ||
| 229 | |||
| 230 | sign2.material = load("res://assets/materials/%s.material" % sign2_color) | ||
| 231 | get_parent().add_child.call_deferred(sign2) | ||
| 232 | |||
| 233 | # Add the strict purple ending validation. | ||
| 234 | if global.map == "the_sun_temple" and ap.strict_purple_ending: | ||
| 235 | var panel_prefab = preload("res://objects/nodes/panel.tscn") | ||
| 236 | var tpl_prefab = preload("res://objects/nodes/listeners/teleportListener.tscn") | ||
| 237 | var reverse_prefab = preload("res://objects/nodes/listeners/reversingListener.tscn") | ||
| 238 | |||
| 239 | var previous_panel = null | ||
| 240 | var next_y = -100 | ||
| 241 | var words = ["quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"] | ||
| 242 | for word in words: | ||
| 243 | var panel = panel_prefab.instantiate() | ||
| 244 | panel.position = Vector3(0, next_y, 0) | ||
| 245 | next_y -= 10 | ||
| 246 | panel.clue = word | ||
| 247 | panel.symbol = "" | ||
| 248 | panel.answer = word | ||
| 249 | panel.name = "EndCheck_%s" % word | ||
| 250 | |||
| 251 | var tpl = tpl_prefab.instantiate() | ||
| 252 | tpl.teleport_point = Vector3(0, 1, 0) | ||
| 253 | tpl.teleport_rotate = Vector3(-45, 180, 0) | ||
| 254 | tpl.target_path = panel | ||
| 255 | tpl.name = "Teleport" | ||
| 256 | |||
| 257 | if previous_panel == null: | ||
| 258 | tpl.senders.append(NodePath("/root/scene/Panels/End/panel_24")) | ||
| 259 | else: | ||
| 260 | tpl.senders.append(NodePath("../../%s" % previous_panel.name)) | ||
| 261 | |||
| 262 | var reversing = reverse_prefab.instantiate() | ||
| 263 | reversing.senders.append(NodePath("..")) | ||
| 264 | reversing.name = "Reversing" | ||
| 265 | tpl.senders.append(NodePath("../Reversing")) | ||
| 266 | |||
| 267 | panel.add_child.call_deferred(tpl) | ||
| 268 | panel.add_child.call_deferred(reversing) | ||
| 269 | get_parent().get_node("Panels").add_child.call_deferred(panel) | ||
| 270 | |||
| 271 | previous_panel = panel | ||
| 272 | |||
| 273 | # Duplicate the doors that usually wait on EQUINOX. We can't set the senders | ||
| 274 | # here for some reason so we actually set them in the door ready function. | ||
| 275 | var endplat = get_node("/root/scene/Components/Doors/EndPlatform") | ||
| 276 | var endplat2 = endplat.duplicate() | ||
| 277 | endplat2.name = "spe_EndPlatform" | ||
| 278 | endplat.get_parent().add_child.call_deferred(endplat2) | ||
| 279 | endplat.queue_free() | ||
| 280 | |||
| 281 | var entry2 = get_node("/root/scene/Components/Doors/entry_2") | ||
| 282 | var entry22 = entry2.duplicate() | ||
| 283 | entry22.name = "spe_entry_2" | ||
| 284 | entry2.get_parent().add_child.call_deferred(entry22) | ||
| 285 | entry2.queue_free() | ||
| 286 | |||
| 287 | # Add the strict cyan ending validation. | ||
| 288 | if global.map == "the_parthenon" and ap.strict_cyan_ending: | ||
| 289 | var panel_prefab = preload("res://objects/nodes/panel.tscn") | ||
| 290 | var tpl_prefab = preload("res://objects/nodes/listeners/teleportListener.tscn") | ||
| 291 | var reverse_prefab = preload("res://objects/nodes/listeners/reversingListener.tscn") | ||
| 292 | |||
| 293 | var previous_panel = null | ||
| 294 | var next_y = -100 | ||
| 295 | var words = ["quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"] | ||
| 296 | for word in words: | ||
| 297 | var panel = panel_prefab.instantiate() | ||
| 298 | panel.position = Vector3(0, next_y, 0) | ||
| 299 | next_y -= 10 | ||
| 300 | panel.clue = word | ||
| 301 | panel.symbol = "." | ||
| 302 | panel.answer = "%s%s" % [word, word] | ||
| 303 | panel.name = "EndCheck_%s" % word | ||
| 304 | |||
| 305 | var tpl = tpl_prefab.instantiate() | ||
| 306 | tpl.teleport_point = Vector3(0, 1, -11) | ||
| 307 | tpl.teleport_rotate = Vector3(-45, 0, 0) | ||
| 308 | tpl.target_path = panel | ||
| 309 | tpl.name = "Teleport" | ||
| 310 | |||
| 311 | if previous_panel == null: | ||
| 312 | tpl.senderGroup.append(NodePath("/root/scene/Panels/Rulers")) | ||
| 313 | else: | ||
| 314 | tpl.senders.append(NodePath("../../%s" % previous_panel.name)) | ||
| 315 | |||
| 316 | var reversing = reverse_prefab.instantiate() | ||
| 317 | reversing.senders.append(NodePath("..")) | ||
| 318 | reversing.name = "Reversing" | ||
| 319 | tpl.senders.append(NodePath("../Reversing")) | ||
| 320 | |||
| 321 | panel.add_child.call_deferred(tpl) | ||
| 322 | panel.add_child.call_deferred(reversing) | ||
| 323 | get_parent().get_node("Panels").add_child.call_deferred(panel) | ||
| 324 | |||
| 325 | previous_panel = panel | ||
| 326 | |||
| 327 | # Duplicate the door that usually waits on the rulers. We can't set the | ||
| 328 | # senders here for some reason so we actually set them in the door ready | ||
| 329 | # function. | ||
| 330 | var entry1 = get_node("/root/scene/Components/Doors/entry_1") | ||
| 331 | var entry12 = entry1.duplicate() | ||
| 332 | entry12.name = "spe_entry_1" | ||
| 333 | entry1.get_parent().add_child.call_deferred(entry12) | ||
| 334 | entry1.queue_free() | ||
| 335 | |||
| 198 | super._ready() | 336 | super._ready() |
| 199 | 337 | ||
| 200 | await get_tree().process_frame | 338 | await get_tree().process_frame |
| @@ -218,3 +356,7 @@ func _set_up_invis_wall(x, y, z, sx, sy, sz): | |||
| 218 | newwall.visibility_range_fade_mode = RenderingServer.VISIBILITY_RANGE_FADE_SELF | 356 | newwall.visibility_range_fade_mode = RenderingServer.VISIBILITY_RANGE_FADE_SELF |
| 219 | newwall.skeleton = ".." | 357 | newwall.skeleton = ".." |
| 220 | get_parent().add_child.call_deferred(newwall) | 358 | get_parent().add_child.call_deferred(newwall) |
| 359 | |||
| 360 | |||
| 361 | func _process(_dt): | ||
| 362 | compass.update_rotation(global_rotation.y) | ||
