aboutsummaryrefslogtreecommitdiff
path: root/client/global.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/global.gd')
-rw-r--r--client/global.gd53
1 files changed, 38 insertions, 15 deletions
diff --git a/client/global.gd b/client/global.gd
index a47cff12..2ee550b0 100644
--- a/client/global.gd
+++ b/client/global.gd
@@ -25,14 +25,15 @@ var default_profile := {
"username": "Giovanni",
"character": 0,
"last_server_url": "",
- # HINTS:
- "has_seen_nametags": false,
- "has_moved": false,
- "has_boosted": false,
- "has_interacted": false,
- "has_rotated": false,
- "has_reset": false,
- "has_zoomed": false
+ "hints": {
+ "has_seen_nametags": false,
+ "has_moved": false,
+ "has_boosted": false,
+ "has_interacted": false,
+ "has_rotated": false,
+ "has_reset": false,
+ "has_zoomed": false
+ }
}
var languages := [tr("System default"), "en", "de"]
var using_joypad := false
@@ -56,6 +57,7 @@ var default_settings := {
"debug_info": ToggleSetting.new(tr("Display debug info (Framerate, etc.)"), false),
"grass_amount": RangeSetting.new(tr("3D grass amount per grass tile"), 16, 0, 32),
"setup_complete": ToggleSetting.new(tr("Initial setup complete. (Uncheck and restart to reenter)"), false),
+ "tutorial_started": ToggleSetting.new(tr("Tutorial started. (Uncheck and restart to replay)"), false),
"latch_boost": ToggleSetting.new(tr("Always extend boost to maximum duration"), true)
}
@@ -71,17 +73,17 @@ func _ready():
profile = load_dict("user://profile", default_profile)
load_settings("user://settings")
apply_settings()
-
+
get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe)
get_viewport().gui_focus_changed.connect(func (node): focused_node = node)
-
+
func _input(event):
if Input.is_action_just_pressed("fullscreen"):
Global.set_setting("fullscreen", not Global.get_setting("fullscreen"))
save_settings()
update_fullscreen()
-
+
# Update using_joypad variable
if event is InputEventMouseButton or event is InputEventKey:
if using_joypad:
@@ -95,7 +97,7 @@ func _input(event):
func apply_settings():
update_fullscreen()
update_language()
-
+
# Anti-aliasing
match get_setting("aa"):
0:
@@ -114,12 +116,12 @@ func apply_settings():
get_viewport().msaa_2d = Viewport.MSAA_4X
get_viewport().msaa_3d = Viewport.MSAA_4X
get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
-
+
# Temporal Anti-aliasing
get_viewport().use_taa = get_setting("taa")
-
+
emit_signal("settings_changed")
-
+
# UI scale
match get_setting("ui_scale"):
0:
@@ -127,6 +129,10 @@ func apply_settings():
1:
get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
+ if not get_setting("tutorial_started"):
+ for k in profile["hints"].keys():
+ set_profile(k, false)
+
func update_language():
var lang_idx: int = get_setting("language")
var lang = languages[lang_idx]
@@ -229,6 +235,23 @@ func set_profile(key: String, value):
profile[key] = value
save_profile()
+
+func set_hint(key: String, value: bool):
+ if !profile["hints"].has(key):
+ push_error("Tried to set hint \"%s\", which does not yet exist (missing key)" % key)
+ if profile["hints"][key] != value:
+ if value:
+ set_setting("tutorial_started", true)
+ profile["hints"][key] = value
+ save_profile()
+
+func get_hint(key: String):
+ if profile["hints"].has(key):
+ return profile["hints"][key]
+ else:
+ push_error("Tried to access hint \"%s\", which does not exist (missing key)" % key)
+ return null
+
static func interpolate(current, target, dt):
return target + (current - target) * exp(-dt)