Class l2df.manager.kinds

Last updated 2021-05-28 15:24:22

Kinds manager.

Info:

Functions

Manager:init([kwargs]) Configure KindsManager.
Manager:add(filepath) Loads and adds the kind file to the local collection.
Manager:load(directory) Loads kind files from the specified directory.
Manager:run(kind, ...) Runs specified kind with arguments.
Manager:get(kind) Gets a kind from the list by its key.

Fields

Kind Kind is a function for handling collision events.


Functions

Methods
Manager:init([kwargs])
Configure KindsManager. Currently does nothing.

Parameters:

  • kwargs table Keyword arguments. Not actually used yet. (optional)

Returns:

    l2df.manager.kinds
Manager:add(filepath)
Loads and adds the kind file to the local collection.

Parameters:

  • filepath string Path to the ".lua" file containing kind-function. Name of the file will be used as kind's ID.
Manager:load(directory)
Loads kind files from the specified directory.

Parameters:

  • directory string Directory to scan for ".lua" files containing kind-function. For each loaded script name of the file will be used as kind's ID.
Manager:run(kind, ...)
Runs specified kind with arguments.

Parameters:

Returns:

    mixed or nil Result of the kind-function execution.
Manager:get(kind)
Gets a kind from the list by its key.

Parameters:

  • kind number or string ID / name of the kind

Returns:

    l2df.manager.kinds.Kind or nil

Fields

Kind function
Kind is a function for handling collision events.
It assepts these arguments:
* e1 (l2df.class.entity) - the first entity for the triggered collision;
* e2 (l2df.class.entity) - the second entity for the triggered collision;
* c1 (l2df.manager.physix.Collider) - collider of the first entity;
* c2 (l2df.manager.physix.Collider) - collider of the second entity.