Class l2df.manager.states
States manager.
Info:
- Copyright: Atom-TM 2020
- Author: Kasai
Functions
Manager:init([kwargs]) | Configure StatesManager. |
Manager:add(filepath) | Adds the state file to the list. |
Manager:load(folderpath) | Loads state files from the specified folder. |
Manager:run(state, ...) | Run specified state with arguments. |
Manager:get(state) | Gets a state from the list by its key. |
Fields
State | State is a function for processing entities' logic depending on their frame / current "state". |
Functions
Methods- Manager:init([kwargs])
-
Configure StatesManager.
Currently does nothing.
Parameters:
- kwargs table Keyword arguments. Not actually used. (optional)
Returns:
- Manager:add(filepath)
-
Adds the state file to the list.
Parameters:
- filepath string Path to the state script-file.
- Manager:load(folderpath)
-
Loads state files from the specified folder.
Parameters:
- folderpath string Path to the directory containing state script-files.
- Manager:run(state, ...)
-
Run specified state with arguments.
Parameters:
- state number or string State name.
- ... Arguments passed to the state-function.
Returns:
-
mixed or nil
Result of the state-function execution.
- Manager:get(state)
-
Gets a state from the list by its key.
Parameters:
- state number or string State name.
Returns:
-
l2df.manager.states.State or nil
Fields
- State function
-
State is a function for processing entities' logic depending on their frame / current "state".
It assepts these arguments:
*obj
(l2df.class.entity) - entity instance for which this state was attached;
*data
(l2df.class.entity.data) - entity's data;
*params
(State or ConstantState) - table containing different additional data.