Skip to content

Commit 41fc050

Browse files
committed
Add project setting to skip the sokobans
The Sokobans may be repurposed in the future. For now, add a setting so developers can skip them with a debug setting, in project.godot or in an override.cfg local file. In the settings addon, add a class name so scripts can reference the settings by the constant. For that, move the "threadbare/" prefix to the constants and add an assertion for the prefix. Also move the comment to hint strings.
1 parent 856660f commit 41fc050

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

addons/threadbare_project_settings/threadbare_project_settings.gd

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
# SPDX-FileCopyrightText: The Threadbare Authors
22
# SPDX-License-Identifier: MPL-2.0
33
@tool
4+
class_name ThreadbareProjectSettings
45
extends EditorPlugin
56

6-
## Debug aspect ratio while playing the game.
7-
const DEBUG_ASPECT_RATIO = "debugging/debug_aspect_ratio"
7+
const DEBUG_ASPECT_RATIO = "threadbare/debugging/debug_aspect_ratio"
8+
const SKIP_SOKOBANS = "threadbare/debugging/skip_sokobans"
89

910
static var setttings_configuration = {
1011
DEBUG_ASPECT_RATIO:
1112
{
1213
value = false,
1314
type = TYPE_BOOL,
15+
hint_string = "Display a letterbox overlay in the game, to debug aspect ratio issues.",
16+
},
17+
SKIP_SOKOBANS:
18+
{
19+
value = false,
20+
type = TYPE_BOOL,
21+
hint_string = "Skip the sokobans from the core game loop, and complete the quest directly.",
1422
},
1523
}
1624

@@ -20,9 +28,9 @@ func _enter_tree() -> void:
2028

2129

2230
static func setup_threadbare_settings() -> void:
23-
for key: String in setttings_configuration:
24-
var setting_config: Dictionary = setttings_configuration[key]
25-
var setting_name: String = "threadbare/%s" % key
31+
for setting_name: String in setttings_configuration:
32+
var setting_config: Dictionary = setttings_configuration[setting_name]
33+
assert(setting_name.begins_with("threadbare"))
2634

2735
if not ProjectSettings.has_setting(setting_name):
2836
ProjectSettings.set_setting(setting_name, setting_config.value)

scenes/game_elements/props/eternal_loom/components/eternal_loom.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ func _on_interaction_ended() -> void:
5858
if _have_threads:
5959
# Hide interact label during scene transition
6060
interact_area.disabled = true
61-
62-
GameState.set_incorporating_threads(true)
63-
SceneSwitcher.change_to_file_with_transition(SOKOBANS.pick_random())
61+
if not ProjectSettings.get_setting(ThreadbareProjectSettings.SKIP_SOKOBANS):
62+
GameState.set_incorporating_threads(true)
63+
SceneSwitcher.change_to_file_with_transition(SOKOBANS.pick_random())
64+
else:
65+
GameState.mark_quest_completed()
6466

6567

6668
func on_offering_succeeded() -> void:

scenes/globals/aspect_ratio_debugger/aspect_ratio_debugger.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ extends CanvasLayer
44

55

66
func _ready() -> void:
7-
if not ProjectSettings.get_setting("threadbare/debugging/debug_aspect_ratio"):
7+
if not ProjectSettings.get_setting(ThreadbareProjectSettings.DEBUG_ASPECT_RATIO):
88
queue_free()

0 commit comments

Comments
 (0)