about summary refs log tree commit diff stats
path: root/client/Archipelago/worldport.gd
blob: cdca2485c1e8d2dd3777aaffb7cf05224ae3a7b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } 
extends "res://scripts/nodes/worldport.gd"

var absolute_rotation = false
var target_rotation = 0


func _ready():
	var node_path = String(
		get_tree().get_root().get_node("scene").get_path_to(self).get_concatenated_names()
	)

	var ap = global.get_node("Archipelago")

	if ap.shuffle_worldports:
		var gamedata = global.get_node("Gamedata")
		var port_id = gamedata.get_port_for_map_node_path(global.map, node_path)
		if port_id != null:
			if port_id in ap.port_pairings:
				var target_port = gamedata.objects.get_ports()[ap.port_pairings[port_id]]
				var target_room = gamedata.objects.get_rooms()[target_port.get_room_id()]
				var target_map = gamedata.objects.get_maps()[target_room.get_map_id()]

				exit = target_map.get_name()
				entry_point.x = target_port.get_destination().get_x()
				entry_point.y = target_port.get_destination().get_y()
				entry_point.z = target_port.get_destination().get_z()
				absolute_rotation = true
				target_rotation = target_port.get_rotation()
				sets_entry_point = true
				invisible = false
				fades = true

	if global.map == "icarus" and exit == "daedalus":
		if not ap.daedalus_roof_access:
			entry_point = Vector3(58, 10, 0)

	super._ready()


func bodyEntered(body):
	if body.is_in_group("player"):
		if absolute_rotation:
			entry_rotate.y = target_rotation - body.rotation_degrees.y

	super.bodyEntered(body)


func changeScene():
	var player = get_tree().get_root().get_node("scene/player")
	if player != null:
		player.playable = false

	super.changeScene()