From 238fccef95ef0557a90c003a682b4c373abda0f6 Mon Sep 17 00:00:00 2001 From: Vaillant Jeremy Date: Sun, 17 May 2026 14:48:20 +0200 Subject: [PATCH] Fix gdlint findings in Global / Database / Levels - Global.gd: move @onready var animation below the regular vars (gdlint class-definitions-order expects onready vars after public/private vars). - Database.gd::DB: move the three _*_PROPS constants above the vars (constants come before vars in a class body). - Levels.gd:_search_button_to_use: drop the elif after a branch that returns (no-elif-return). - Levels.gd:_gyroscope_changed_{down,up}: continuation lines of the multi-line return mixed two tabs + three spaces; normalised to pure tabs. No semantic change: @onready is property-level so source ordering doesn't affect init; elif after a return is equivalent to if; the continuation indent is cosmetic. Co-Authored-By: Claude Opus 4.7 (1M context) --- scenes/levels/Levels.gd | 6 +++--- scripts/Database.gd | 10 +++++----- scripts/Global.gd | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scenes/levels/Levels.gd b/scenes/levels/Levels.gd index 3817bfc..0e64c30 100644 --- a/scenes/levels/Levels.gd +++ b/scenes/levels/Levels.gd @@ -75,7 +75,7 @@ func _get_node_animated() -> Node: func _search_button_to_use(counter: int) -> Node: if counter == 0: return object_first.instantiate() - elif counter == meshes.size() - 1: + if counter == meshes.size() - 1: return object_last.instantiate() return object_std.instantiate() @@ -184,13 +184,13 @@ func _gyroscope_changed_right(gyroscope: Vector3) -> bool: func _gyroscope_changed_down(gyroscope: Vector3) -> bool: return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \ gyroscope.z > gyroscope_value_old.z or \ - (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ + (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ gyroscope.x > gyroscope_value_old.x func _gyroscope_changed_up(gyroscope: Vector3) -> bool: return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \ gyroscope.z < gyroscope_value_old.z or \ - (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ + (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ gyroscope.x < gyroscope_value_old.x func _start_dissolve(key: String) -> void: diff --git a/scripts/Database.gd b/scripts/Database.gd index 1053f75..71562fc 100644 --- a/scripts/Database.gd +++ b/scripts/Database.gd @@ -9,11 +9,6 @@ extends Node # (per-scene lock state) persists across runs. class DB extends RefCounted: - var settings: SettingsData - var levels: Array[LevelEntry] = [] - var scenes: Array[SceneEntry] = [] - var _path: String - const _SETTINGS_PROPS := [ {"name": "langue", "type": "1", "auto_increment": "0"}, {"name": "gyroscope", "type": "0", "auto_increment": "0"}, @@ -36,6 +31,11 @@ class DB extends RefCounted: {"name": "counter", "type": "1", "auto_increment": "0"}, ] + var settings: SettingsData + var levels: Array[LevelEntry] = [] + var scenes: Array[SceneEntry] = [] + var _path: String + func _init(path: String) -> void: _path = path var f := FileAccess.open(path, FileAccess.READ) diff --git a/scripts/Global.gd b/scripts/Global.gd index 74c538d..e432163 100644 --- a/scripts/Global.gd +++ b/scripts/Global.gd @@ -2,8 +2,6 @@ extends Control # Application root: async scene loading + reference to the loaded Database. -@onready var animation: AnimationPlayer = Loading.get_node("AnimLoading") - var current_scene: Node = null var current_scene_int: int = -1 var wait_frames: int = 1 @@ -11,6 +9,8 @@ var database: RefCounted = null var loaded: bool = false var _loading_path: String = "" +@onready var animation: AnimationPlayer = Loading.get_node("AnimLoading") + func _ready() -> void: database = load("res://scripts/Database.gd").new().initialize() _initialize_current_scene()