PlayerActionsHelper
Various managers for community usage.
About this mod Author’s original text
Player Actions Helper
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.
Change log
v0.0.1
- Fixed a small bug
v0.0.0
- Initial Release
Properties
RegisteredActions
ReadOnlyDictionary RegisteredActions { get; }
Description
A list of all actions registered so far.
Classes
ActionInfo
class ActionInfo
Fields
- string name;
- BindingSource keyboardlayout;
- BindingSource controllerLayout;
Constructors
ActionInfo()
ActionInfo ActionInfo(string name, BindingSource keyboardlayout = null, BindingSource controllerLayout = null)
Description
Creates a set of information for usage in binding player actions.
Parameters
- string name The name for the action.
- BindingSource keyboardlayout An optional parameter for setting the default keyboard layout.
- BindingSource controllerLayout An optional parameter for setting the default controller layout.
Example Usage
PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));
Functions
RegisterPlayerAction()
void RegisterPlayerAction(ActionInfo actionInfo)
Description
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.
Parameters
- ActionInfo actionInfo the details of the action to be registered.
Example Usage
PlayerActionManager.RegisterPlayerAction(new ActionInfo("ToggleFlight", new KeyBindingSource(Key.Key1), new DeviceBindingSource(InputControlType.Action3)));
ExtensionMethods
GetPlayerAction()
PlayerAction GetPlayerAction(this PlayerActions playerActions, string name)
Description
Returns a registered PlayerAction that has been created for the player. Returns null if the action doesn't exist.
Parameters
- string name the name of the registered action.
Example Usage
player.data.playerActions.GetPlayerAction(name);
ActionWasPressed()
bool ActionWasPressed(this PlayerActions playerActions, string name)
Description
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.
Parameters
- string name the name of the registered action.
Example Usage
player.data.playerActions.ActionWasPressed(name);
ActionIsPressed()
bool ActionIsPressed(this PlayerActions playerActions, string name)
Description
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.
Parameters
- string name the name of the registered action.
Example Usage
player.data.playerActions.ActionIsPressed(name);
ActionWasReleased()
bool ActionWasReleased(this PlayerActions playerActions, string name)
Description
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.
Parameters
- string name the name of the registered action.
Example Usage
player.data.playerActions.ActionWasReleased(name);
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.
Install these first, or the mod will not work: