diff options
Diffstat (limited to 'apworld/client/worldport.gd')
| -rw-r--r-- | apworld/client/worldport.gd | 61 |
1 files changed, 61 insertions, 0 deletions
| diff --git a/apworld/client/worldport.gd b/apworld/client/worldport.gd new file mode 100644 index 0000000..ed9891e --- /dev/null +++ b/apworld/client/worldport.gd | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | extends "res://scripts/nodes/worldport.gd" | ||
| 2 | |||
| 3 | var absolute_rotation = false | ||
| 4 | var target_rotation = 0 | ||
| 5 | |||
| 6 | var port_id = null | ||
| 7 | |||
| 8 | |||
| 9 | func _ready(): | ||
| 10 | var node_path = String( | ||
| 11 | get_tree().get_root().get_node("scene").get_path_to(self).get_concatenated_names() | ||
| 12 | ) | ||
| 13 | |||
| 14 | var ap = global.get_node("Archipelago") | ||
| 15 | |||
| 16 | if ap.shuffle_worldports: | ||
| 17 | var gamedata = global.get_node("Gamedata") | ||
| 18 | port_id = gamedata.get_port_for_map_node_path(global.map, node_path) | ||
| 19 | if port_id != null: | ||
| 20 | if port_id in ap.port_pairings: | ||
| 21 | var target_port = gamedata.objects.get_ports()[ap.port_pairings[port_id]] | ||
| 22 | var target_room = gamedata.objects.get_rooms()[target_port.get_room_id()] | ||
| 23 | var target_map = gamedata.objects.get_maps()[target_room.get_map_id()] | ||
| 24 | |||
| 25 | exit = target_map.get_name() | ||
| 26 | entry_point.x = target_port.get_destination().get_x() | ||
| 27 | entry_point.y = target_port.get_destination().get_y() | ||
| 28 | entry_point.z = target_port.get_destination().get_z() | ||
| 29 | absolute_rotation = true | ||
| 30 | target_rotation = target_port.get_rotation() | ||
| 31 | sets_entry_point = true | ||
| 32 | invisible = false | ||
| 33 | fades = true | ||
| 34 | else: | ||
| 35 | port_id = null | ||
| 36 | |||
| 37 | if global.map == "icarus" and exit == "daedalus": | ||
| 38 | if not ap.daedalus_roof_access: | ||
| 39 | entry_point = Vector3(58, 10, 0) | ||
| 40 | |||
| 41 | super._ready() | ||
| 42 | |||
| 43 | |||
| 44 | func bodyEntered(body): | ||
| 45 | if body.is_in_group("player"): | ||
| 46 | if port_id != null: | ||
| 47 | var ap = global.get_node("Archipelago") | ||
| 48 | ap.client.checkWorldport(port_id) | ||
| 49 | |||
| 50 | if absolute_rotation: | ||
| 51 | entry_rotate.y = target_rotation - body.rotation_degrees.y | ||
| 52 | |||
| 53 | super.bodyEntered(body) | ||
| 54 | |||
| 55 | |||
| 56 | func changeScene(): | ||
| 57 | var player = get_tree().get_root().get_node("scene/player") | ||
| 58 | if player != null: | ||
| 59 | player.playable = false | ||
| 60 | |||
| 61 | super.changeScene() | ||
