#29 Small fixes
Build / build (push) Successful in 1m6s
Publish / build (push) Failing after 1m16s

This commit is contained in:
2026-05-15 10:52:26 +02:00
parent d957c02373
commit acd8d65b95
2 changed files with 53 additions and 5 deletions
@@ -0,0 +1,48 @@
When writing or reviewing GDScript code, strictly follow the official Godot Engine GDScript style guide and file naming conventions:
---
### **Code Formatting**
1. **Indentation**: Use **4 spaces** (no tabs).
2. **Line Length**: Keep lines under **100 characters** where possible.
3. **Naming Conventions**:
- **Variables/functions**: `snake_case` (e.g., `player_health`, `calculate_damage()`).
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `MAX_SPEED = 100`).
- **Class Names**: `PascalCase` (e.g., `class_name Player.gd`).
- **Signals**: `snake_case` (e.g., `signal player_died`).
4. **Spacing**:
- Add spaces around operators (`x = y + z`, not `x=y+z`).
- No space after `(` or before `)` in function calls (e.g., `func(a, b)`).
5. **Braces**: Open braces on the same line for `if`, `for`, `func`, etc.:
```gdscript
if x > 0:
print("Positive")
```
6. **Docstrings**: Use **Godots built-in docstring format** for functions:
```gdscript
## Calculates the player's speed based on input.
## @param delta: Time since last frame (float).
## @return: The adjusted speed (float).
func calculate_speed(delta: float) -> float:
return base_speed * delta
```
7. **Type Hints**: Always include type hints for parameters and return values (Godot 4+).
8. **Avoid Redundancy**: Omit redundant `self.` unless required for clarity.
---
### **File Naming Conventions**
1. **Script Files**:
- Use **`snake_case`** for `.gd` files (e.g., `player.gd`, `enemy_ai.gd`).
- Match the filename to the **class name** (if the script defines a class).
Example: If the class is `Player`, the file should be `player.gd`.
2. **Scene Files**:
- Use **`PascalCase`** for `.tscn` files (e.g., `Player.tscn`, `MainMenu.tscn`).
- Match the filename to the **root node** of the scene.
3. **Resource Files**:
- Use **`snake_case`** for `.tres` or `.res` files (e.g., `player_stats.tres`).
4. **Folders**:
- Use **`snake_case`** for directories (e.g., `scripts/`, `assets/sprites/`).
- Group related files logically (e.g., `player/` for `player.gd`, `player.tscn`).
---
**Reference**: [Godot GDScript Style Guide](https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_styleguide.html).
+5 -5
View File
@@ -55,10 +55,6 @@ func _ready() -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if audio_player.has_stream_playback() && !is_changing && !audio_player.stream_paused: if audio_player.has_stream_playback() && !is_changing && !audio_player.stream_paused:
print("Settings.hide_beginning: ", Settings.hide_beginning)
print("audio_player.get_playback_position(): ", audio_player.get_playback_position())
print("audio_player.get_playback_position() >= 5.0: ", audio_player.get_playback_position() >= 5.0)
print("(!Settings.hide_beginning && audio_player.get_playback_position() >= 5.0): ", (!Settings.hide_beginning && audio_player.get_playback_position() >= 5.0))
if (!Settings.hide_beginning || audio_player.get_playback_position() >= 5.0): if (!Settings.hide_beginning || audio_player.get_playback_position() >= 5.0):
progress_slider.value = audio_player.get_playback_position() progress_slider.value = audio_player.get_playback_position()
if stream != null: if stream != null:
@@ -72,8 +68,12 @@ func format_time(time: float) -> String:
return mins + ":" + sec return mins + ":" + sec
func format_text(part: float, total: float) -> String: func format_text(part: float, total: float) -> String:
if Settings.hide_length: if (Settings.hide_beginning && part <= 5.0) && Settings.hide_length:
return "??:?? / ??:??"
elif Settings.hide_length:
return format_time(part) + " / ??:??" return format_time(part) + " / ??:??"
elif Settings.hide_beginning && part <= 5.0:
return "??:?? / " + format_time(total)
else: else:
return format_time(part) + " / " + format_time(total) return format_time(part) + " / " + format_time(total)