about summary refs log tree commit diff stats
path: root/data/maps/the_wise/connections.txtpb
blob: e3aa07b8a1e11d5c1c84cb2165a92351834aaa98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
connections {
  from_room: "Entry"
  to_room: "Puzzles"
  door { name: "Front Door" }
}
connections {
  from_room: "Puzzles"
  to_room: "Mastery"
  door { name: "Mastery" }
}
t: bold } /* Literal.Number.Integer.Long */
extends "res://scripts/nodes/door.gd"

var item_id
var item_amount


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

	var gamedata = global.get_node("Gamedata")
	var door_id = gamedata.get_door_for_map_node_path(global.map, node_path)
	if door_id != null:
		var ap = global.get_node("Archipelago")
		var item_lock = ap.get_item_id_for_door(door_id)

		if item_lock != null:
			item_id = item_lock[0]
			item_amount = item_lock[1]

			self.senders = []
			self.senderGroup = []
			self.nested = false
			self.complete_at = 0
			self.max_length = 0
			self.excludeSenders = []

			call_deferred("_readier")

	super._ready()


func _readier():
	var ap = global.get_node("Archipelago")

	if ap.client.getItemAmount(item_id) >= item_amount:
		handleTriggered()