Maaack / Godot-Game-Template

Godot template with a main menu, options menus, pause menu, credits, scene loader, extra tools, and an example game scene.
MIT License
283 stars 17 forks source link

Options: Controls: Cannot customize built-in actions (starting with "ui_") #98

Closed hsandt closed 1 month ago

hsandt commented 1 month ago

All built-in actions, namely starting with ui_ are filtered out from the remappable Controls options:

AppSettings.gd

static func get_filtered_action_names() -> Array[StringName]:
    var return_list : Array[StringName] = []
    var action_list : Array[StringName] = InputMap.get_actions()
    for action_name in action_list:
        if not action_name.begins_with("ui_"):
            return_list.append(action_name)
    return return_list

which prevents us from displaying and customizing actions like "ui_cancel", which is used to go Back in the menu, and therefore useful to customize when using gamepad.

In practice I don't think it's a big issue, because it's more rare to customize such actions, and I can always customize my scripts to use another action name to go back.

However, since the template itself uses it, I thought it would be nice if we could add a list of whitelisted actions so we can force show a few actions even if they start with "ui_", but not all of them (which would be annoying).

Even when not modifying some inputs, it's nice to be able to display the mappings for such inputs (however, display only would require a "read-only" mode showing inputs without the +/- buttons, a bit more work and maybe less intuitive for the player).

For now I'll manually tweak get_filtered_action_names to get the mappings I need.