Files
Bullosseum/settings.gd
T
richard 56593c58cf Release 0.2.0: device-aware controls, spear, settings, shaders
Show touch controls only on touch platforms and keyboard hints only on
desktop, via a shared Controls.use_touch_ui() gate (is_touchscreen_available
is unreliable with emulate_touch_from_mouse). Bumps version to 0.2.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-09 19:39:37 +03:00

50 lines
1.3 KiB
GDScript

extends Node
## Player-facing game options (autoload `Settings`), persisted to user://settings.cfg.
## Distinct from DP (debug tunables) and Controls (keybinds): this is the small set of
## comfort/accessibility toggles the options menu exposes to the player.
signal changed(key: String, value: Variant)
const SAVE_PATH := "user://settings.cfg"
const SECTION := "options"
## Master screen-shake toggle — gates every camera_iso.trigger_hit (hits and ability FX).
var screen_shake: bool = true
## Gore toggle — when off, no blood spawns (impact spurt + ongoing spear-wound bleed).
var gore: bool = true
func _ready() -> void:
load_saved()
func set_screen_shake(value: bool) -> void:
if screen_shake == value:
return
screen_shake = value
changed.emit("screen_shake", value)
save()
func set_gore(value: bool) -> void:
if gore == value:
return
gore = value
changed.emit("gore", value)
save()
func save() -> void:
var cfg := ConfigFile.new()
cfg.set_value(SECTION, "screen_shake", screen_shake)
cfg.set_value(SECTION, "gore", gore)
cfg.save(SAVE_PATH)
func load_saved() -> void:
var cfg := ConfigFile.new()
if cfg.load(SAVE_PATH) != OK:
return
screen_shake = cfg.get_value(SECTION, "screen_shake", true) as bool
gore = cfg.get_value(SECTION, "gore", true) as bool