diff options
Diffstat (limited to 'client/Archipelago/player.gd')
-rw-r--r-- | client/Archipelago/player.gd | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/client/Archipelago/player.gd b/client/Archipelago/player.gd new file mode 100644 index 0000000..a84548a --- /dev/null +++ b/client/Archipelago/player.gd | |||
@@ -0,0 +1,42 @@ | |||
1 | extends "res://scripts/nodes/player.gd" | ||
2 | |||
3 | |||
4 | func _ready(): | ||
5 | var ap = global.get_node("Archipelago") | ||
6 | var gamedata = global.get_node("Gamedata") | ||
7 | |||
8 | var map_id = gamedata.map_id_by_name.get(global.map) | ||
9 | for door in gamedata.objects.get_doors(): | ||
10 | if door.get_map_id() != map_id: | ||
11 | continue | ||
12 | |||
13 | if not door.has_ap_id(): | ||
14 | continue | ||
15 | |||
16 | if door.get_type() == gamedata.SCRIPT_proto.DoorType.ITEM_ONLY: | ||
17 | continue | ||
18 | |||
19 | var locationListener = ap.SCRIPT_locationListener.new() | ||
20 | locationListener.location_id = door.get_ap_id() | ||
21 | locationListener.name = "locationListener_%d" % door.get_ap_id() | ||
22 | |||
23 | for panel_ref in door.get_panels(): | ||
24 | # TODO: specific answers | ||
25 | var panel_data = gamedata.objects.get_panels()[panel_ref.get_panel()] | ||
26 | locationListener.senders.append(NodePath("/root/scene/" + panel_data.get_path())) | ||
27 | |||
28 | get_parent().add_child.call_deferred(locationListener) | ||
29 | |||
30 | for letter in gamedata.objects.get_letters(): | ||
31 | var room = gamedata.objects.get_rooms()[letter.get_room_id()] | ||
32 | if room.get_map_id() != map_id: | ||
33 | continue | ||
34 | |||
35 | var locationListener = ap.SCRIPT_locationListener.new() | ||
36 | locationListener.location_id = letter.get_ap_id() | ||
37 | locationListener.name = "locationListener_%d" % letter.get_ap_id() | ||
38 | locationListener.senders.append(NodePath("/root/scene/" + letter.get_path())) | ||
39 | |||
40 | get_parent().add_child.call_deferred(locationListener) | ||
41 | |||
42 | super._ready() | ||