#include <s_player.h>
Public Member Functions | |
virtual | ~ScriptApiPlayer ()=default |
void | on_newplayer (ServerActiveObject *player) |
void | on_dieplayer (ServerActiveObject *player, const PlayerHPChangeReason &reason) |
bool | on_respawnplayer (ServerActiveObject *player) |
bool | on_prejoinplayer (const std::string &name, const std::string &ip, std::string *reason) |
bool | can_bypass_userlimit (const std::string &name, const std::string &ip) |
void | on_joinplayer (ServerActiveObject *player, s64 last_login) |
void | on_leaveplayer (ServerActiveObject *player, bool timeout) |
void | on_cheat (ServerActiveObject *player, const std::string &cheat_type) |
bool | on_punchplayer (ServerActiveObject *player, ServerActiveObject *hitter, float time_from_last_punch, const ToolCapabilities *toolcap, v3f dir, s32 damage) |
void | on_rightclickplayer (ServerActiveObject *player, ServerActiveObject *clicker) |
s32 | on_player_hpchange (ServerActiveObject *player, s32 hp_change, const PlayerHPChangeReason &reason) |
void | on_playerReceiveFields (ServerActiveObject *player, const std::string &formname, const StringMap &fields) |
void | on_authplayer (const std::string &name, const std::string &ip, bool is_success) |
int | player_inventory_AllowMove (const MoveAction &ma, int count, ServerActiveObject *player) |
int | player_inventory_AllowPut (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) |
int | player_inventory_AllowTake (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) |
void | player_inventory_OnMove (const MoveAction &ma, int count, ServerActiveObject *player) |
void | player_inventory_OnPut (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) |
void | player_inventory_OnTake (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player) |
Public Member Functions inherited from ScriptApiBase | |
ScriptApiBase (ScriptingType type) | |
ScriptApiBase () | |
virtual | ~ScriptApiBase () |
DISABLE_CLASS_COPY (ScriptApiBase) | |
void | loadMod (const std::string &script_path, const std::string &mod_name) |
void | loadScript (const std::string &script_path) |
void | runCallbacksRaw (int nargs, RunCallbacksMode mode, const char *fxn) |
void | addObjectReference (ServerActiveObject *cobj) |
void | removeObjectReference (ServerActiveObject *cobj) |
ScriptingType | getType () |
IGameDef * | getGameDef () |
Server * | getServer () |
const std::string & | getOrigin () |
void | setOriginDirect (const char *origin) |
void | setOriginFromTableRaw (int index, const char *fxn) |
void | clientOpenLibs (lua_State *L) |
void | checkSetByBuiltin () |
Private Member Functions | |
void | pushPutTakeArguments (const char *method, const InventoryLocation &loc, const std::string &listname, int index, const ItemStack &stack, ServerActiveObject *player) |
void | pushMoveArguments (const MoveAction &ma, int count, ServerActiveObject *player) |
Additional Inherited Members | |
Static Public Member Functions inherited from ScriptApiBase | |
static std::string | getCurrentModNameInsecure (lua_State *L) |
static std::string | getCurrentModName (lua_State *L) |
Protected Member Functions inherited from ScriptApiBase | |
lua_State * | getStack () |
void | realityCheck () |
void | scriptError (int result, const char *fxn) |
void | stackDump (std::ostream &o) |
void | setGameDef (IGameDef *gamedef) |
Environment * | getEnv () |
void | setEnv (Environment *env) |
EmergeThread * | getEmergeThread () |
void | setEmergeThread (EmergeThread *emerge) |
void | objectrefGetOrCreate (lua_State *L, ServerActiveObject *cobj) |
void | pushPlayerHPChangeReason (lua_State *L, const PlayerHPChangeReason &reason) |
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. | |
Protected Attributes inherited from ScriptApiBase | |
std::recursive_mutex | m_luastackmutex |
std::string | m_last_run_mod |
bool | m_secure = false |
int | m_lock_recursion_count {} |
std::thread::id | m_owning_thread |
|
virtualdefault |
bool ScriptApiPlayer::can_bypass_userlimit | ( | const std::string & | name, |
const std::string & | ip ) |
References RUN_CALLBACKS_MODE_OR, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::handleCommand_Init().
void ScriptApiPlayer::on_authplayer | ( | const std::string & | name, |
const std::string & | ip, | ||
bool | is_success ) |
References RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::handleCommand_FirstSrp(), and Server::handleCommand_SrpBytesM().
void ScriptApiPlayer::on_cheat | ( | ServerActiveObject * | player, |
const std::string & | cheat_type ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::checkInteractDistance(), Server::handleCommand_Interact(), and Server::process_PlayerPos().
void ScriptApiPlayer::on_dieplayer | ( | ServerActiveObject * | player, |
const PlayerHPChangeReason & | reason ) |
References ScriptApiBase::objectrefGetOrCreate(), ScriptApiBase::pushPlayerHPChangeReason(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::HandlePlayerDeath().
void ScriptApiPlayer::on_joinplayer | ( | ServerActiveObject * | player, |
s64 | last_login ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::handleCommand_ClientReady().
void ScriptApiPlayer::on_leaveplayer | ( | ServerActiveObject * | player, |
bool | timeout ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::DeleteClient().
void ScriptApiPlayer::on_newplayer | ( | ServerActiveObject * | player | ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::emergePlayer().
s32 ScriptApiPlayer::on_player_hpchange | ( | ServerActiveObject * | player, |
s32 | hp_change, | ||
const PlayerHPChangeReason & | reason ) |
References ScriptApiBase::objectrefGetOrCreate(), PCALL_RES, PUSH_ERROR_HANDLER, ScriptApiBase::pushPlayerHPChangeReason(), and SCRIPTAPI_PRECHECKHEADER.
Referenced by PlayerSAO::setHP().
void ScriptApiPlayer::on_playerReceiveFields | ( | ServerActiveObject * | player, |
const std::string & | formname, | ||
const StringMap & | fields ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_OR_SC, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::handleCommand_InventoryFields().
bool ScriptApiPlayer::on_prejoinplayer | ( | const std::string & | name, |
const std::string & | ip, | ||
std::string * | reason ) |
References LuaHelper::readParam(), RUN_CALLBACKS_MODE_OR, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by Server::handleCommand_Init().
bool ScriptApiPlayer::on_punchplayer | ( | ServerActiveObject * | player, |
ServerActiveObject * | hitter, | ||
float | time_from_last_punch, | ||
const ToolCapabilities * | toolcap, | ||
v3f | dir, | ||
s32 | damage ) |
References dir(), ScriptApiBase::objectrefGetOrCreate(), push_tool_capabilities(), push_v3f(), LuaHelper::readParam(), RUN_CALLBACKS_MODE_OR, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by PlayerSAO::punch().
bool ScriptApiPlayer::on_respawnplayer | ( | ServerActiveObject * | player | ) |
References ScriptApiBase::objectrefGetOrCreate(), LuaHelper::readParam(), RUN_CALLBACKS_MODE_OR, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by PlayerSAO::respawn().
void ScriptApiPlayer::on_rightclickplayer | ( | ServerActiveObject * | player, |
ServerActiveObject * | clicker ) |
References ScriptApiBase::objectrefGetOrCreate(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by PlayerSAO::rightClick().
int ScriptApiPlayer::player_inventory_AllowMove | ( | const MoveAction & | ma, |
int | count, | ||
ServerActiveObject * | player ) |
References pushMoveArguments(), RUN_CALLBACKS_MODE_OR_SC, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by IMoveAction::allowMove().
int ScriptApiPlayer::player_inventory_AllowPut | ( | const MoveAction & | ma, |
const ItemStack & | stack, | ||
ServerActiveObject * | player ) |
References ItemStack::count, pushPutTakeArguments(), RUN_CALLBACKS_MODE_OR_SC, runCallbacks, SCRIPTAPI_PRECHECKHEADER, MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
Referenced by IMoveAction::allowPut().
int ScriptApiPlayer::player_inventory_AllowTake | ( | const MoveAction & | ma, |
const ItemStack & | stack, | ||
ServerActiveObject * | player ) |
References ItemStack::count, MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, pushPutTakeArguments(), RUN_CALLBACKS_MODE_OR_SC, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by IMoveAction::allowTake().
void ScriptApiPlayer::player_inventory_OnMove | ( | const MoveAction & | ma, |
int | count, | ||
ServerActiveObject * | player ) |
References pushMoveArguments(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by IMoveAction::onMove().
void ScriptApiPlayer::player_inventory_OnPut | ( | const MoveAction & | ma, |
const ItemStack & | stack, | ||
ServerActiveObject * | player ) |
References pushPutTakeArguments(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, SCRIPTAPI_PRECHECKHEADER, MoveAction::to_i, MoveAction::to_inv, and MoveAction::to_list.
Referenced by IMoveAction::onPut().
void ScriptApiPlayer::player_inventory_OnTake | ( | const MoveAction & | ma, |
const ItemStack & | stack, | ||
ServerActiveObject * | player ) |
References MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, pushPutTakeArguments(), RUN_CALLBACKS_MODE_FIRST, runCallbacks, and SCRIPTAPI_PRECHECKHEADER.
Referenced by IMoveAction::onTake().
|
private |
References InvRef::create(), MoveAction::from_i, MoveAction::from_inv, MoveAction::from_list, ScriptApiBase::getStack(), ScriptApiBase::objectrefGetOrCreate(), MoveAction::to_i, and MoveAction::to_list.
Referenced by player_inventory_AllowMove(), and player_inventory_OnMove().
|
private |
References InvRef::create(), LuaItemStack::create(), ScriptApiBase::getStack(), and ScriptApiBase::objectrefGetOrCreate().
Referenced by player_inventory_AllowPut(), player_inventory_AllowTake(), player_inventory_OnPut(), and player_inventory_OnTake().