Files
SurvivalOfTheSnippest/level/ui/scripts/escape_menu.gd
T
Scottlg aba42e2a02 Add escape menu and weapon slot tooltips to character sheet
- Escape Menu:
  - Opens with Escape key from base game screen
  - Resume button to return to game
  - Exit Game button to quit application
  - Character sheet closes with Escape if open (takes priority)
  - Mouse capture/release handled by UI components

- Weapon Slot System:
  - Visual weapon boxes (80x80) in character sheet
  - Display weapon icons from WeaponData
  - Empty slots appear dimmed
  - Hover tooltips show weapon stats (not clipped by containers)
  - Tooltips display: slot name, weapon name, damage, range, cooldown, knockback, block percentage
  - Tooltips positioned globally to avoid ScrollContainer clipping

- Bug Fixes:
  - Fixed typo in lilguy_body.gd (dwextends -> extends)
  - Removed manual mouse toggle from player (now handled by UI)

- Updated character_sheet.gd to use weapon slot components instead of text labels
- Added weapon_tooltip.tscn as separate scene for unclipped tooltips
2025-11-16 23:11:51 +00:00

47 lines
1.0 KiB
GDScript

extends Control
class_name EscapeMenu
## Escape menu that opens when Escape is pressed
## Allows player to exit the game or resume playing
# Visibility
var is_visible: bool = false
# Player reference (to control mouse mode)
var player: Character = null
func _ready():
# Start hidden
hide()
is_visible = false
func _input(event):
# Toggle on Escape press
if event.is_action_pressed("quit"):
toggle_menu()
get_viewport().set_input_as_handled()
## Set the player reference
func set_player(p: Character):
player = p
## Toggle menu visibility
func toggle_menu():
is_visible = !is_visible
if is_visible:
show()
# Release mouse when opening menu
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
hide()
# Recapture mouse when closing menu
if player and player.is_multiplayer_authority():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
## Called when Resume button is clicked
func _on_resume_pressed():
toggle_menu()
## Called when Exit button is clicked
func _on_exit_pressed():
get_tree().quit()