Arena polish: in-run HUD, no free loot, retire-with-winnings
- HUD arena status (top center): live wave number and run gold, driven by GameState signals, torn down cleanly on HUD.reset() - Free floor weapons removed: the initial sword/shield spawn is gone and manually placed level.tscn weapons are deleted server-side at init. Gear now only enters play via the armory or enemy drops. - Retire to Camp: new escape-menu button (shown only while alive in an active run) banks 100% of run gold and keeps all gear - the counterweight to death's 10% settlement. Exit Game and window close also bank winnings before quitting. - CLAUDE.md rewritten for the gladiator arena era: core loop, autoloads, economy API, RPC patterns, verification workflow.
This commit is contained in:
@@ -39,6 +39,11 @@ signal loadout_changed(loadout: Dictionary)
|
||||
func _ready() -> void:
|
||||
load_save()
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
# Closing the window mid-run counts as walking out alive - bank the winnings
|
||||
if what == NOTIFICATION_WM_CLOSE_REQUEST and run_active:
|
||||
retire_run()
|
||||
|
||||
# --- Persistence ---------------------------------------------------------
|
||||
|
||||
func load_save() -> void:
|
||||
@@ -186,6 +191,31 @@ func end_run() -> Dictionary:
|
||||
run_ended.emit(last_run_stats)
|
||||
return last_run_stats
|
||||
|
||||
## Walk out of the arena alive: bank 100% of run gold, keep all gear.
|
||||
## The reward for retiring instead of dying (death only keeps 10%).
|
||||
func retire_run() -> Dictionary:
|
||||
if not run_active:
|
||||
return last_run_stats
|
||||
run_active = false
|
||||
|
||||
last_run_stats = {
|
||||
"waves": current_wave,
|
||||
"kills": kills_this_run,
|
||||
"time": get_run_time(),
|
||||
"gold_earned": run_gold,
|
||||
"total_value": get_total_value(),
|
||||
"kept": banked_gold + run_gold,
|
||||
"retired": true,
|
||||
}
|
||||
|
||||
banked_gold += run_gold
|
||||
run_gold = 0
|
||||
gold_changed.emit(banked_gold)
|
||||
run_gold_changed.emit(run_gold)
|
||||
save_game()
|
||||
run_ended.emit(last_run_stats)
|
||||
return last_run_stats
|
||||
|
||||
# --- Multiplayer crediting (server -> owning peer) ------------------------
|
||||
# GameState is an autoload, so it exists at the same path on every peer with
|
||||
# the server (peer 1) as its multiplayer authority. The server decides who
|
||||
|
||||
Reference in New Issue
Block a user