21 lines
609 B
GDScript3
21 lines
609 B
GDScript3
|
|
class_name SkipAnimations
|
||
|
|
extends RefCounted
|
||
|
|
## The "Skip animations" setting (View ▾): every roll shows its result at once,
|
||
|
|
## with no flicker, beads or pop-up motion. Shift-click does the same for one roll.
|
||
|
|
|
||
|
|
const SETTING := "skip_animations"
|
||
|
|
|
||
|
|
## Used when there is no state store (tests that build a bare Main).
|
||
|
|
static var _skip_mem := false
|
||
|
|
|
||
|
|
|
||
|
|
static func on(m: Main) -> bool:
|
||
|
|
return bool(m.state.get_setting(SETTING, false)) if m and m.state else _skip_mem
|
||
|
|
|
||
|
|
|
||
|
|
static func set_on(m: Main, value: bool) -> void:
|
||
|
|
_skip_mem = value
|
||
|
|
if m and m.state:
|
||
|
|
m.state.set_setting(SETTING, value)
|
||
|
|
m.state.save()
|