feat(progression): XP, niveaux et popups flottants (+N XP)

Nouvel autoload PlayerProgress qui gagne de l'XP sur:
- cassage de blocs (gain variable selon le type: perle, épave, coral > sand)
- collecte de perles (+25)
- crafting (+10)
- paliers de profondeur atteints (+20 à 10/25/50/75/100m)

HUD: barre XP + label niveau en bas centre, bannière "NIVEAU X" au level-up
(son bulle + fade). Popup 3D "+N XP" spawn au point d'action.

Boucle court-terme dopamine: chaque action = feedback visuel immédiat.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 18:08:26 +00:00
parent 982a4ec23d
commit 984754183f
7 changed files with 260 additions and 2 deletions

View File

@@ -52,4 +52,12 @@ static func craft(inventory: Inventory, recipe_index: int) -> bool:
var leftover: int = inventory.add_item(recipe["output"]["item_id"], recipe["output"]["count"])
if leftover > 0:
push_warning("CraftingRecipes: craft overflow — %d items lost" % leftover)
_award_craft_xp(recipe)
return true
static func _award_craft_xp(recipe: Dictionary) -> void:
var pp: Node = Engine.get_main_loop().root.get_node_or_null("/root/PlayerProgress")
if pp == null:
return
pp.award(pp.XP_CRAFT, "craft %s" % str(recipe.get("name", "")), Vector3.ZERO)