feat(gameplay): consommables utilisables avec touche [F]

- DolphinController expose heal/feed/refill_oxygen + signal
  use_consumable_requested (bindé sur F)
- Main.gd table CONSUMABLE_EFFECTS:
  · Bulle d'air (102): +40 O₂
  · Algue cuisinée (103): +30 faim, +5 HP
  · Amulette de soin (106): +50 HP
- Popup flottant coloré au-dessus du joueur + son bulle à l'utilisation
- HUD: hint dynamique "[F] Consommer : <item>" quand slot sélectionné = consommable

Boucle court-terme: le craft a enfin un usage direct, récompense lisible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 18:12:56 +00:00
parent 7f6811995d
commit 27459e1eaa
3 changed files with 100 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ signal hotbar_scroll(direction: int)
signal echolocation_triggered(position: Vector3, radius: float)
signal stats_changed(oxygen: float, health: float, hunger: float)
signal player_died()
signal use_consumable_requested()
# --- Internal State ---
var oxygen: float
@@ -61,6 +62,7 @@ func _setup_input_actions() -> void:
"boost": KEY_CTRL,
"echolocate": KEY_E,
"toggle_inventory": KEY_TAB,
"use_consumable": KEY_F,
}
for action_name: String in actions:
if not InputMap.has_action(action_name):
@@ -103,6 +105,8 @@ func _input(event: InputEvent) -> void:
_do_raycast_place()
if event.is_action_pressed("echolocate"):
_trigger_echolocation()
if event.is_action_pressed("use_consumable"):
use_consumable_requested.emit()
func _physics_process(delta: float) -> void:
@@ -264,6 +268,21 @@ func take_damage(amount: float) -> void:
player_died.emit()
func heal(amount: float) -> void:
health = min(max_health, health + amount)
_emit_stats()
func feed(amount: float) -> void:
hunger = min(max_hunger, hunger + amount)
_emit_stats()
func refill_oxygen(amount: float) -> void:
oxygen = min(max_oxygen, oxygen + amount)
_emit_stats()
func _trigger_echolocation() -> void:
if is_echolocating:
return