Player/Keybinds.cs
namespace PlanetMeat;

public sealed class Keybinds( Scene scene ) : GameObjectSystem<Keybinds>( scene )
{
	private readonly Dictionary<string, InputAction> cachedActions = [];

	private InputAction GetAction( string actionName )
	{
		if ( actionName == "" )
			return null;

		if ( cachedActions.TryGetValue( actionName, out InputAction cached ) )
			return cached;

		if ( Input.GetActions().FirstOrDefault( a => a.Name == actionName ) is InputAction found )
		{
			cachedActions[actionName] = found;
			return found;
		}

		return null;
	}

	public string GetKeycode( string action ) => GetAction( action )?.KeyboardCode;
}