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:
2026-07-01 23:47:03 +01:00
parent 1562b37563
commit f5e0642b39
5 changed files with 253 additions and 158 deletions
+42
View File
@@ -9,11 +9,27 @@ var is_visible: bool = false
# Player reference (to control mouse mode)
var player: Character = null
var _retire_button: Button = null
func _ready():
# Start hidden
hide()
is_visible = false
# Insert "Retire to Camp" between Resume and Exit - leave alive, bank everything
var vbox = get_node_or_null("Panel/MarginContainer/VBoxContainer")
var exit_button = get_node_or_null("Panel/MarginContainer/VBoxContainer/ExitButton")
if vbox and exit_button:
_retire_button = Button.new()
_retire_button.name = "RetireButton"
_retire_button.custom_minimum_size = Vector2(0, 50)
_retire_button.add_theme_color_override("font_color", Color.WHITE)
_retire_button.add_theme_color_override("font_hover_color", Color(1, 0.8, 0))
_retire_button.add_theme_font_size_override("font_size", 20)
_retire_button.pressed.connect(_on_retire_pressed)
vbox.add_child(_retire_button)
vbox.move_child(_retire_button, exit_button.get_index())
func _input(event):
# Toggle on Escape press
if event.is_action_pressed("quit"):
@@ -29,6 +45,7 @@ func toggle_menu():
is_visible = !is_visible
if is_visible:
show()
_update_retire_button()
# Release mouse when opening menu
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
@@ -37,10 +54,35 @@ func toggle_menu():
if player and player.is_multiplayer_authority():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
## Retiring is only possible while alive with an active run
func _update_retire_button():
if not _retire_button:
return
var can_retire = GameState.run_active and player and not player.is_dead
_retire_button.visible = can_retire
if can_retire:
_retire_button.text = "Retire to Camp (+%dg)" % GameState.run_gold
## Called when Resume button is clicked
func _on_resume_pressed():
toggle_menu()
## Walk out alive: bank all run gold, keep gear, return to the menu
func _on_retire_pressed():
GameState.retire_run()
multiplayer.multiplayer_peer = null
Network.players.clear()
if has_node("/root/HUD"):
get_node("/root/HUD").reset()
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
get_tree().reload_current_scene()
## Called when Exit button is clicked
func _on_exit_pressed():
# Leaving alive still banks your winnings (GameState also catches window close)
if GameState.run_active and player and not player.is_dead:
GameState.retire_run()
get_tree().quit()