Added gameplay_input manager.
Refactored menus, player, and escape_capsule to utilize new system. Actions defined in Godot project file with default bindings. Player/Vehicles now react to actions and GameplayInput states instead of polling Input directly. They respond to commands via `_handle_gameplay_command` and should not implement _unhandled_input directly. Kept some debugging input handling code in `player.gd` for things like F3/F5/F4/PageUp/PageDown. We may want to move much of this out of `player.gd` into something that handles the gamestate more generally.
This commit is contained in:
@@ -64,6 +64,7 @@ var culture_buttons: Array[Button] = []
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
GameplayInput.set_menu_open(self, true)
|
||||
name_input = _find("NameInput") as LineEdit
|
||||
background_list = _find("BackgroundL") as Control
|
||||
if background_list == null:
|
||||
@@ -126,6 +127,20 @@ func _ready() -> void:
|
||||
if backgrounds.size() > 0:
|
||||
_select_background(backgrounds[0])
|
||||
_set_sex("male")
|
||||
if sex_male:
|
||||
sex_male.grab_focus()
|
||||
|
||||
|
||||
## Controller cancel follows the existing back command without changing creation data.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
get_viewport().set_input_as_handled()
|
||||
_on_back()
|
||||
|
||||
|
||||
## Releases menu ownership when entering gameplay or returning to the main menu.
|
||||
func _exit_tree() -> void:
|
||||
GameplayInput.set_menu_open(self, false)
|
||||
|
||||
|
||||
func _find(n: String) -> Node:
|
||||
|
||||
Reference in New Issue
Block a user