The Relentless is complicated because it makes heavy use of the keyholder mechanic. There are three rooms, and you are expected to enter each room missing certain letters. Solving the available puzzles in each room opens the doors between the rooms, which lets you cross into them with a different set of missing letters. There currently isn't a way to represent "is missing certain letters" in our map data or randomizer state. Instead, we use rooms to emulate knowing which letters are available. There is a room for each of the three entrances, containing the puzzles solvable with the expected missing letters. There's a room for each of the inner pairs of rooms, representing what becomes available when one of the doors is opened, and a room representing what is solvable when both doors are opened. This is all done with the expectation that you are always entering The Relentless with the correct letters in the Control Center's keyholders. Because of this, the warps to The Relentless are not randomizable. The Control Center keywords that open these warps are also not randomizable. It'd be nice to find a way to randomize this at a later point. Also note that in order to keep this functioning properly, if the player receives a letter item while in The Relentless, the mod should hold off on adding it to the player's keyboard. We may want to overhaul how keyholders work entirely and just have some kind of thing in the Archipelago client's global state. about summary refs log tree commit diff stats
path: root/client/Archipelago/textclient.gd
blob: 85cc6d2a271fa91f3459a0ac5d8084c32dc631e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
extends CanvasLayer

var panel
var label
var entry
var is_open = false


func _ready():
	process_mode = ProcessMode.PROCESS_MODE_ALWAYS

	panel = Panel.new()
	panel.set_name("Panel")
	panel.offset_left = 100
	panel.offset_right = 1820
	panel.offset_top = 100
	panel.offset_bottom = 980
	panel.visible = false
	add_child(panel)

	label = RichTextLabel.new()
	label.set_name("Label")
	label.offset_left = 80
	label.offset_right = 1640
	label.offset_top = 80
	label.offset_bottom = 720
	label.scroll_following = true
	label.selection_enabled = true
	panel.add_child(label)

	label.push_font(load("res://assets/fonts/Lingo2.ttf"))
	label.push_font_size(36)

	var entry_style = StyleBoxFlat.new()
	entry_style.bg_color = Color(0.9, 0.9, 0.9, 1)

	entry = LineEdit.new()
	entry.set_name("Entry")
	entry.offset_left = 80
	entry.offset_right = 1640
	entry.offset_top = 760
	entry.offset_bottom = 840
	entry.add_theme_font_override("font", load("res://assets/fonts/Lingo2.ttf"))
	entry.add_theme_font_size_override("font_size", 36)
	entry.add_theme_color_override("font_color", Color(0, 0, 0, 1))
	entry.add_theme_color_override("cursor_color", Color(0, 0, 0, 1))
	entry.add_theme_stylebox_override("focus", entry_style)
	panel.add_child(entry)
	entry.connect("text_submitted", text_entered)


func _input(event):
	if global.loaded and event is InputEventKey and event.pressed:
		if event.keycode == KEY_TAB and !Input.is_key_pressed(KEY_SHIFT):
			if !get_tree().paused:
				is_open = true
				get_tree().paused = true
				Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
				panel.visible = true
				entry.grab_focus()
				get_viewport().set_input_as_handled()
			else:
				dismiss()
		elif event.keycode == KEY_ESCAPE:
			if is_open:
				dismiss()
				get_viewport().set_input_as_handled()


func dismiss():
	if is_open:
		get_tree().paused = false
		Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
		panel.visible = false
		is_open = false


func parse_printjson(text):
	label.append_text("[p]" + text + "[/p]")


func text_entered(text):
	var ap = global.get_node("Archipelago")
	var cmd = text.trim_suffix("\n")
	ap.client.say(cmd)
	entry.text = ""