style(client): gdformat all 52 GDScript files — zero format warnings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 11:09:10 +02:00
co-authored by Claude Opus 4.6
parent 572e66f026
commit 88c7407cb6
52 changed files with 2323 additions and 1061 deletions
+40 -17
View File
@@ -8,10 +8,10 @@ extends Node
## Loaded as HardwareDetector autoload. Tests access via get_node("/root/HardwareDetector").
## Settings dialog reads classification strings and power-state methods to configure the UI.
const RAM_PASS_THRESHOLD_MB := 2000.0
const RAM_PASS_THRESHOLD_MB := 2000.0
const RAM_MARGINAL_THRESHOLD_MB := 1600.0
const TPT_GREEN_THRESHOLD := 6.0 # tokens/sec — enable silently
const TPT_YELLOW_THRESHOLD := 3.0 # tokens/sec — partial pre-voicing note
const TPT_GREEN_THRESHOLD := 6.0 # tokens/sec — enable silently
const TPT_YELLOW_THRESHOLD := 3.0 # tokens/sec — partial pre-voicing note
const TPT_DEGRADATION_THRESHOLD := 0.4 # fraction — >40% sustained drop → yellow
## Benchmark cache path — reads from PlatformInfo for cross-platform correctness.
@@ -28,9 +28,9 @@ var inference_suspended: bool = false
# User's preference at the moment battery suspension activated (to restore on plug-in).
var _pre_battery_pref: bool = true
# -- Lifecycle ----------------------------------------------------------------
func _ready() -> void:
assert(PlatformInfo != null, "PlatformInfo must load before HardwareDetector")
load_ai_pref()
@@ -40,6 +40,7 @@ func _ready() -> void:
# -- Layer 1: RAM classification ----------------------------------------------
## Layer 1 — RAM classification.
## Accepts free MB as input; returns "pass" | "marginal" | "fail".
func classify_ram(free_mb: float) -> String:
@@ -54,11 +55,15 @@ func classify_ram(free_mb: float) -> String:
## Returns: {classification: String, free_mb: float}
func check_ram() -> Dictionary:
PlatformInfo.refresh_memory()
return {"classification": classify_ram(PlatformInfo.free_memory_mb), "free_mb": PlatformInfo.free_memory_mb}
return {
"classification": classify_ram(PlatformInfo.free_memory_mb),
"free_mb": PlatformInfo.free_memory_mb
}
# -- Layer 2: TPT benchmark classification ------------------------------------
## Layer 2 — TPT benchmark classification.
## Accepts tokens/sec as input; returns "green" | "yellow" | "red".
func classify_tpt(tps: float) -> String:
@@ -90,6 +95,7 @@ func read_benchmark_cache() -> Variant:
# -- Layer 3: degradation + battery -------------------------------------------
## Layer 3 — Ongoing TPT degradation classification.
## D-138 §8: >40% sustained drop from baseline → yellow (not forced disable).
## Returns "ok" | "yellow".
@@ -130,6 +136,7 @@ func is_inference_suspended() -> bool:
# -- Startup pref load --------------------------------------------------------
## Load AI dialogue preference from settings.cfg and apply to GameState.
## Called from _ready() to restore the toggle state across session restarts.
## Spec: D-138 §8 — toggle persists via ConfigFile (client-local) + server SQLite (#627).
@@ -144,6 +151,7 @@ func load_ai_pref() -> void:
# -- Battery suspend/resume ---------------------------------------------------
func _on_power_profile_changed(old_profile: int, new_profile: int) -> void:
if new_profile == PlatformInfo.PowerProfile.BATTERY:
_suspend_for_battery()
@@ -176,34 +184,49 @@ func _resume_from_battery() -> void:
func _send_settings_change(enabled: bool) -> void:
if SimBridge.state != SimBridge.ConnectionState.CONNECTED:
return
SimBridge.send_input({
"action": InputMapper.Action.CHANGE_SETTINGS,
"action_data": {"ai_enhanced_dialogue": enabled},
"timestamp_msec": Time.get_ticks_msec(),
})
(
SimBridge
. send_input(
{
"action": InputMapper.Action.CHANGE_SETTINGS,
"action_data": {"ai_enhanced_dialogue": enabled},
"timestamp_msec": Time.get_ticks_msec(),
}
)
)
# -- Status message -----------------------------------------------------------
## Compose a human-readable status message for the settings dialog.
## classification: "pass" | "marginal" | "fail" (RAM) or "green" | "yellow" | "red" (TPT).
## Returns empty string when no message is needed.
func status_message(ram_classification: String, tpt_classification: String, free_mb: float, tps: float) -> String:
func status_message(
ram_classification: String, tpt_classification: String, free_mb: float, tps: float
) -> String:
if ram_classification == "fail":
return (
"AI-Enhanced Dialogue requires 2 GB of free memory. Your system currently has %.0f MB available."
(
"AI-Enhanced Dialogue requires 2 GB of free memory. Your system currently has %.0f MB available."
+ " Close other applications and try again, or leave the setting off — the game is complete either way."
) % free_mb
)
% free_mb
)
if ram_classification == "marginal":
return "Only %.0f MB free — performance may vary. You can still enable it." % free_mb
match tpt_classification:
"yellow":
return (
"Running at %.0f t/s — pre-voicing will work for main characters and key scenes."
(
"Running at %.0f t/s — pre-voicing will work for main characters and key scenes."
+ " Background NPCs may show base text until the queue catches up."
) % tps
)
% tps
)
"red":
return (
"Running very slowly at %.0f t/s — we recommend leaving this off, but the choice is yours."
) % tps
("Running very slowly at %.0f t/s — we recommend leaving this off, but the choice is yours.")
% tps
)
return ""