about summary refs log tree commit diff stats
path: root/apworld/client/pauseMenu.gd
blob: 72b45e80e54b0861768ccf9da5d76f2b9ee4068d (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
87
88
89
90
91
extends "res://scripts/ui/pauseMenu.gd"

var compass_button
var locations_button
var minimap_button


func _ready():
	var ap_panel = Panel.new()
	ap_panel.name = "Archipelago"
	get_node("menu/settings/settingsInner/TabContainer").add_child(ap_panel)

	var ap = global.get_node("Archipelago")

	compass_button = CheckBox.new()
	compass_button.text = "show compass"
	compass_button.button_pressed = ap.show_compass
	compass_button.position = Vector2(65, 100)
	compass_button.theme = preload("res://assets/themes/baseUI.tres")
	compass_button.add_theme_font_size_override("font_size", 60)
	compass_button.pressed.connect(_toggle_compass)
	ap_panel.add_child(compass_button)

	locations_button = CheckBox.new()
	locations_button.text = "show locations overlay"
	locations_button.button_pressed = ap.show_locations
	locations_button.position = Vector2(65, 200)
	locations_button.theme = preload("res://assets/themes/baseUI.tres")
	locations_button.add_theme_font_size_override("font_size", 60)
	locations_button.pressed.connect(_toggle_locations)
	ap_panel.add_child(locations_button)

	minimap_button = CheckBox.new()
	minimap_button.text = "show minimap"
	minimap_button.button_pressed = ap.show_minimap
	minimap_button.position = Vector2(65, 300)
	minimap_button.theme = preload("res://assets/themes/baseUI.tres")
	minimap_button.add_theme_font_size_override("font_size", 60)
	minimap_button.pressed.connect(_toggle_minimap)
	ap_panel.add_child(minimap_button)

	super._ready()


func _pause_game():
	global.get_node("Textclient").dismiss()
	super._pause_game()


func _main_menu():
	global.loaded = false
	global.get_node("Archipelago").disconnect_from_ap()
	global.get_node("Messages").clear()
	global.get_node("Compass").visible = false
	global.get_node("Textclient").reset()

	autosplitter.reset()
	_unpause_game()
	Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
	musicPlayer.stop()

	var runtime = global.get_node("Runtime")
	runtime.load_script_as_scene.call_deferred("settings_screen.gd", "settings_screen")


func _toggle_compass():
	var ap = global.get_node("Archipelago")
	ap.show_compass = compass_button.button_pressed
	ap.saveSettings()

	var compass = global.get_node("Compass")
	compass.visible = compass_button.button_pressed


func _toggle_locations():
	var ap = global.get_node("Archipelago")
	ap.show_locations = locations_button.button_pressed
	ap.saveSettings()

	var textclient = global.get_node("Textclient")
	textclient.update_locations_visibility()


func _toggle_minimap():
	var ap = global.get_node("Archipelago")
	ap.show_minimap = minimap_button.button_pressed
	ap.saveSettings()

	var minimap = get_tree().get_root().get_node("scene/Minimap")
	if minimap != null:
		minimap.visible = ap.show_minimap
n class="p">) pool += [self.create_item(trap_name) for trap_name in bad_letters] for i in range(0, item_difference): pool.append(self.create_item(self.get_filler_item_name())) if not any(ItemClassification.progression in item.classification for item in pool): raise OptionError(f"Lingo 2 player {self.player} has no progression items. Please enable at least one " f"option that would add progression gating to your world, such as Shuffle Doors or " f"Shuffle Letters.") self.multiworld.itempool += pool def create_item(self, name: str) -> Item: return Lingo2Item(name, ItemClassification.filler if name == self.get_filler_item_name() else ItemClassification.trap if name in ANTI_COLLECTABLE_TRAPS else ItemClassification.progression, self.item_name_to_id.get(name), self.player) def set_rules(self): self.multiworld.completion_condition[self.player] = lambda state: state.has("Victory", self.player) def fill_slot_data(self): slot_options = [ "cyan_door_behavior", "daedalus_roof_access", "enable_gift_maps", "enable_icarus", "endings_requirement", "keyholder_sanity", "masteries_requirement", "shuffle_control_center_colors", "shuffle_doors", "shuffle_gallery_paintings", "shuffle_letters", "shuffle_symbols", "shuffle_worldports", "strict_cyan_ending", "strict_purple_ending", "victory_condition", ] slot_data: dict[str, object] = { **self.options.as_dict(*slot_options), "version": self.static_logic.get_data_version(), } if self.options.shuffle_worldports: slot_data["port_pairings"] = self.port_pairings return slot_data def get_filler_item_name(self) -> str: return "A Job Well Done" # for the universal tracker, doesn't get called in standard gen # docs: https://github.com/FarisTheAncient/Archipelago/blob/tracker/worlds/tracker/docs/re-gen-passthrough.md @staticmethod def interpret_slot_data(slot_data: dict[str, object]) -> dict[str, object]: # returning slot_data so it regens, giving it back in multiworld.re_gen_passthrough # we are using re_gen_passthrough over modifying the world here due to complexities with ER return slot_data def launch_client(*args): from .context import client_main launch_component(client_main, name="Lingo2Client", args=args) icon_paths["lingo2_ico"] = f"ap:{__name__}/logo.png" component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, description="Open Lingo 2.", supports_uri=True, game_name="Lingo 2", icon="lingo2_ico") components.append(component)