A mod designed to make creating player actions simpler.
Register an action with PlayerActionManager.RegisterPlayerAction() in your mod's awake function.
Access that action with player.data.playerActions.GetPlayerAction() in your mod.
Properties
ReadOnlyDictionary<string, ActionInfo> RegisteredActions { get; }A list of all actions registered so far.
Classes
class ActionInfo- string name;
- BindingSource keyboardlayout;
- BindingSource controllerLayout;
ActionInfo ActionInfo(string name, BindingSource keyboardlayout = null, BindingSource controllerLayout = null)Creates a set of information for usage in binding player actions.
- string
nameThe name for the action. - BindingSource
keyboardlayoutAn optional parameter for setting the default keyboard layout. - BindingSource
controllerLayoutAn optional parameter for setting the default controller layout.
PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));Functions
void RegisterPlayerAction(ActionInfo actionInfo)Registers an action to be automatically generated for players.
NOTE: You should only be registering actions in your mod's awake function. If you register them any later, they will not show in rebind controls.
- ActionInfo
actionInfothe details of the action to be registered.
PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));ExtensionMethods
PlayerAction GetPlayerAction(this PlayerActions playerActions, string name)Returns a registered PlayerAction that has been created for the player. Returns null if the action doesn't exist.
- string
namethe name of the registered action.
player.data.playerActions.GetPlayerAction(name);bool ActionWasPressed(this PlayerActions playerActions, string name)Returns whether a registered action was pressed. Returns false if the action doesn't exist.
Note that this is an alternative to fetching the action and then checking the PlayerAction::WasPressed property.
- string
namethe name of the registered action.
player.data.playerActions.ActionWasPressed(name);bool ActionIsPressed(this PlayerActions playerActions, string name)Returns whether a registered action is pressed. Returns false if the action doesn't exist.
Note that this is an alternative to fetching the action and then checking the PlayerAction::IsPressed property.
- string
namethe name of the registered action.
player.data.playerActions.ActionIsPressed(name);bool ActionWasReleased(this PlayerActions playerActions, string name)Returns whether a registered action was released. Returns false if the action doesn't exist.
Note that this is an alternative to fetching the action and then checking the PlayerAction::WasReleased property.
- string
namethe name of the registered action.
player.data.playerActions.ActionWasReleased(name);