Luanti 5.16.0-dev
Loading...
Searching...
No Matches
LuaLocalPlayer Class Reference

#include <l_localplayer.h>

Inheritance diagram for LuaLocalPlayer:
Collaboration diagram for LuaLocalPlayer:

Public Member Functions

 LuaLocalPlayer (LocalPlayer *m)
 ~LuaLocalPlayer ()=default

Static Public Member Functions

static void create (lua_State *L, LocalPlayer *m)
static void Register (lua_State *L)
Static Public Member Functions inherited from ModApiBase
static ScriptApiBasegetScriptApiBase (lua_State *L)
static ServergetServer (lua_State *L)
static ServerInventoryManagergetServerInventoryMgr (lua_State *L)
static EmergeThreadgetEmergeThread (lua_State *L)
static IGameDefgetGameDef (lua_State *L)
static EnvironmentgetEnv (lua_State *L)
static std::string getCurrentModPath (lua_State *L)
template<typename T>
static T * getScriptApi (lua_State *L)
static bool registerFunction (lua_State *L, const char *name, lua_CFunction func, int top)
template<typename T>
static void registerClass (lua_State *L, const luaL_Reg *methods, const luaL_Reg *metamethods)
template<typename T>
static T * checkObject (lua_State *L, int narg)
static int l_deprecated_function (lua_State *L, const char *good, const char *bad, lua_CFunction func)
 A wrapper for deprecated functions.

Static Public Attributes

static const char className [] = "LocalPlayer"

Static Private Member Functions

static int gc_object (lua_State *L)
static int l_get_velocity (lua_State *L)
static int l_get_hp (lua_State *L)
static int l_get_name (lua_State *L)
static int l_get_wield_index (lua_State *L)
static int l_get_wielded_item (lua_State *L)
static int l_is_attached (lua_State *L)
static int l_is_touching_ground (lua_State *L)
static int l_is_in_liquid (lua_State *L)
static int l_is_in_liquid_stable (lua_State *L)
static int l_is_climbing (lua_State *L)
static int l_swimming_vertical (lua_State *L)
static int l_get_physics_override (lua_State *L)
static int l_get_override_pos (lua_State *L)
static int l_get_last_pos (lua_State *L)
static int l_get_last_velocity (lua_State *L)
static int l_get_last_look_vertical (lua_State *L)
static int l_get_last_look_horizontal (lua_State *L)
static int l_get_control (lua_State *L)
static int l_get_breath (lua_State *L)
static int l_get_pos (lua_State *L)
static int l_get_movement_acceleration (lua_State *L)
static int l_get_movement_speed (lua_State *L)
static int l_get_movement (lua_State *L)
static int l_get_armor_groups (lua_State *L)
static int l_hud_add (lua_State *L)
static int l_hud_remove (lua_State *L)
static int l_hud_change (lua_State *L)
static int l_hud_get (lua_State *L)
static int l_hud_get_all (lua_State *L)
static int l_get_move_resistance (lua_State *L)
static LocalPlayergetobject (LuaLocalPlayer *ref)
static LocalPlayergetobject (lua_State *L, int narg)

Private Attributes

LocalPlayerm_localplayer = nullptr

Static Private Attributes

static const luaL_Reg methods []

Additional Inherited Members

Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
template<>
s16 readParam (lua_State *L, int index)
template<>
int readParam (lua_State *L, int index)
template<>
float readParam (lua_State *L, int index)
template<>
v2s16 readParam (lua_State *L, int index)
template<>
v2f readParam (lua_State *L, int index)
template<>
v3f readParam (lua_State *L, int index)
template<>
std::string_view readParam (lua_State *L, int index)
template<>
std::string readParam (lua_State *L, int index)
template<>
std::string_view readParam (lua_State *L, int index)
 Read a string from Lua state L at index without copying it.
Static Protected Member Functions inherited from LuaHelper
template<typename T>
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua state L at index.
template<typename T>
static T readParam (lua_State *L, int index, const T &default_value)
 Read a value using a template type T from Lua state L at index.

Constructor & Destructor Documentation

◆ LuaLocalPlayer()

LuaLocalPlayer::LuaLocalPlayer ( LocalPlayer * m)

References m_localplayer.

Referenced by create(), gc_object(), getobject(), getobject(), and l_get_override_pos().

Here is the caller graph for this function:

◆ ~LuaLocalPlayer()

LuaLocalPlayer::~LuaLocalPlayer ( )
default

Member Function Documentation

◆ create()

void LuaLocalPlayer::create ( lua_State * L,
LocalPlayer * m )
static

References LuaLocalPlayer(), and className.

Referenced by ClientScripting::on_client_ready().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gc_object()

int LuaLocalPlayer::gc_object ( lua_State * L)
staticprivate

References LuaLocalPlayer().

Referenced by Register().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getobject() [1/2]

LocalPlayer * LuaLocalPlayer::getobject ( lua_State * L,
int narg )
staticprivate

References LuaLocalPlayer(), ModApiBase::checkObject(), and getobject().

Here is the call graph for this function:

◆ getobject() [2/2]

LocalPlayer * LuaLocalPlayer::getobject ( LuaLocalPlayer * ref)
staticprivate

References LuaLocalPlayer(), and m_localplayer.

Referenced by getobject(), l_get_armor_groups(), l_get_breath(), l_get_control(), l_get_hp(), l_get_last_look_horizontal(), l_get_last_look_vertical(), l_get_last_pos(), l_get_last_velocity(), l_get_move_resistance(), l_get_movement(), l_get_movement_acceleration(), l_get_movement_speed(), l_get_name(), l_get_physics_override(), l_get_pos(), l_get_velocity(), l_get_wield_index(), l_get_wielded_item(), l_hud_add(), l_hud_change(), l_hud_get(), l_hud_get_all(), l_hud_remove(), l_is_attached(), l_is_climbing(), l_is_in_liquid(), l_is_in_liquid_stable(), l_is_touching_ground(), and l_swimming_vertical().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ l_get_armor_groups()

int LuaLocalPlayer::l_get_armor_groups ( lua_State * L)
staticprivate

References LocalPlayer::getCAO(), GenericCAO::getGroups(), getobject(), and push_groups().

Here is the call graph for this function:

◆ l_get_breath()

int LuaLocalPlayer::l_get_breath ( lua_State * L)
staticprivate

References LocalPlayer::getBreath(), and getobject().

Here is the call graph for this function:

◆ l_get_control()

int LuaLocalPlayer::l_get_control ( lua_State * L)
staticprivate

References PlayerControl::aux1, PlayerControl::dig, PlayerControl::direction_keys, PlayerControl::getMovement(), getobject(), Player::getPlayerControl(), PlayerControl::jump, PlayerControl::place, PlayerControl::sneak, and PlayerControl::zoom.

Here is the call graph for this function:

◆ l_get_hp()

int LuaLocalPlayer::l_get_hp ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::hp.

Here is the call graph for this function:

◆ l_get_last_look_horizontal()

int LuaLocalPlayer::l_get_last_look_horizontal ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::last_yaw.

Here is the call graph for this function:

◆ l_get_last_look_vertical()

int LuaLocalPlayer::l_get_last_look_vertical ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::last_pitch.

Here is the call graph for this function:

◆ l_get_last_pos()

int LuaLocalPlayer::l_get_last_pos ( lua_State * L)
staticprivate

References BS, getobject(), LocalPlayer::last_position, and push_v3f().

Here is the call graph for this function:

◆ l_get_last_velocity()

int LuaLocalPlayer::l_get_last_velocity ( lua_State * L)
staticprivate

References getobject(), LocalPlayer::last_speed, and push_v3f().

Here is the call graph for this function:

◆ l_get_move_resistance()

int LuaLocalPlayer::l_get_move_resistance ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::move_resistance.

Here is the call graph for this function:

◆ l_get_movement()

int LuaLocalPlayer::l_get_movement ( lua_State * L)
staticprivate

References getobject(), Player::movement_gravity, Player::movement_liquid_fluidity, Player::movement_liquid_fluidity_smooth, and Player::movement_liquid_sink.

Here is the call graph for this function:

◆ l_get_movement_acceleration()

int LuaLocalPlayer::l_get_movement_acceleration ( lua_State * L)
staticprivate

References getobject(), Player::movement_acceleration_air, Player::movement_acceleration_default, and Player::movement_acceleration_fast.

Here is the call graph for this function:

◆ l_get_movement_speed()

int LuaLocalPlayer::l_get_movement_speed ( lua_State * L)
staticprivate

References getobject(), Player::movement_speed_climb, Player::movement_speed_crouch, Player::movement_speed_fast, Player::movement_speed_jump, and Player::movement_speed_walk.

Here is the call graph for this function:

◆ l_get_name()

int LuaLocalPlayer::l_get_name ( lua_State * L)
staticprivate

References Player::getName(), and getobject().

Here is the call graph for this function:

◆ l_get_override_pos()

int LuaLocalPlayer::l_get_override_pos ( lua_State * L)
staticprivate

References LuaLocalPlayer().

Here is the call graph for this function:

◆ l_get_physics_override()

int LuaLocalPlayer::l_get_physics_override ( lua_State * L)
staticprivate

References getobject(), and Player::physics_override.

Here is the call graph for this function:

◆ l_get_pos()

int LuaLocalPlayer::l_get_pos ( lua_State * L)
staticprivate

References BS, getobject(), LocalPlayer::getPosition(), and push_v3f().

Here is the call graph for this function:

◆ l_get_velocity()

int LuaLocalPlayer::l_get_velocity ( lua_State * L)
staticprivate

References BS, getobject(), Player::getSpeed(), and push_v3f().

Here is the call graph for this function:

◆ l_get_wield_index()

int LuaLocalPlayer::l_get_wield_index ( lua_State * L)
staticprivate

References getobject(), and Player::getWieldIndex().

Here is the call graph for this function:

◆ l_get_wielded_item()

int LuaLocalPlayer::l_get_wielded_item ( lua_State * L)
staticprivate

References LuaItemStack::create(), getobject(), and Player::getWieldedItem().

Here is the call graph for this function:

◆ l_hud_add()

int LuaLocalPlayer::l_hud_add ( lua_State * L)
staticprivate

References Player::addHud(), getobject(), read_hud_element(), and U32_MAX.

Here is the call graph for this function:

◆ l_hud_change()

int LuaLocalPlayer::l_hud_change ( lua_State * L)
staticprivate

References Player::getHud(), getobject(), and read_hud_change().

Here is the call graph for this function:

◆ l_hud_get()

int LuaLocalPlayer::l_hud_get ( lua_State * L)
staticprivate

References Player::getHud(), getobject(), and push_hud_element().

Here is the call graph for this function:

◆ l_hud_get_all()

int LuaLocalPlayer::l_hud_get_all ( lua_State * L)
staticprivate

References Player::getHudElements(), getobject(), and push_hud_element().

Here is the call graph for this function:

◆ l_hud_remove()

int LuaLocalPlayer::l_hud_remove ( lua_State * L)
staticprivate

References getobject(), and Player::removeHud().

Here is the call graph for this function:

◆ l_is_attached()

int LuaLocalPlayer::l_is_attached ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::getParent().

Here is the call graph for this function:

◆ l_is_climbing()

int LuaLocalPlayer::l_is_climbing ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::is_climbing.

Here is the call graph for this function:

◆ l_is_in_liquid()

int LuaLocalPlayer::l_is_in_liquid ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::in_liquid.

Here is the call graph for this function:

◆ l_is_in_liquid_stable()

int LuaLocalPlayer::l_is_in_liquid_stable ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::in_liquid_stable.

Here is the call graph for this function:

◆ l_is_touching_ground()

int LuaLocalPlayer::l_is_touching_ground ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::touching_ground.

Here is the call graph for this function:

◆ l_swimming_vertical()

int LuaLocalPlayer::l_swimming_vertical ( lua_State * L)
staticprivate

References getobject(), and LocalPlayer::swimming_vertical.

Here is the call graph for this function:

◆ Register()

void LuaLocalPlayer::Register ( lua_State * L)
static

References gc_object(), methods, and ModApiBase::registerClass().

Referenced by ClientScripting::InitializeModApi().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ className

const char LuaLocalPlayer::className = "LocalPlayer"
static

Referenced by create().

◆ m_localplayer

LocalPlayer* LuaLocalPlayer::m_localplayer = nullptr
private

Referenced by LuaLocalPlayer(), and getobject().

◆ methods

const luaL_Reg LuaLocalPlayer::methods
staticprivate

Referenced by Register().


The documentation for this class was generated from the following files: