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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user