aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_player.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2020-11-04 16:44:42 +0100
committerGitHub <noreply@github.com>2020-11-04 16:44:42 +0100
commit5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch)
treec980d614fec4a5495798be3e79e033229062c3cd /src/script/cpp_api/s_player.cpp
parent28f6a79706b088c37268a59d90878220dc4ef9c7 (diff)
parent3af10766fd2b58b068e970266724d7eb10e9316b (diff)
downloaddragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz
Merge branch 'master' into master
Diffstat (limited to 'src/script/cpp_api/s_player.cpp')
-rw-r--r--src/script/cpp_api/s_player.cpp66
1 files changed, 26 insertions, 40 deletions
diff --git a/src/script/cpp_api/s_player.cpp b/src/script/cpp_api/s_player.cpp
index 712120c61..c9ab81db9 100644
--- a/src/script/cpp_api/s_player.cpp
+++ b/src/script/cpp_api/s_player.cpp
@@ -39,7 +39,8 @@ void ScriptApiPlayer::on_newplayer(ServerActiveObject *player)
runCallbacks(1, RUN_CALLBACKS_MODE_FIRST);
}
-void ScriptApiPlayer::on_dieplayer(ServerActiveObject *player, const PlayerHPChangeReason &reason)
+void ScriptApiPlayer::on_dieplayer(
+ ServerActiveObject *player, const PlayerHPChangeReason &reason)
{
SCRIPTAPI_PRECHECKHEADER
@@ -56,11 +57,8 @@ void ScriptApiPlayer::on_dieplayer(ServerActiveObject *player, const PlayerHPCha
}
bool ScriptApiPlayer::on_punchplayer(ServerActiveObject *player,
- ServerActiveObject *hitter,
- float time_from_last_punch,
- const ToolCapabilities *toolcap,
- v3f dir,
- s16 damage)
+ ServerActiveObject *hitter, float time_from_last_punch,
+ const ToolCapabilities *toolcap, v3f dir, s16 damage)
{
SCRIPTAPI_PRECHECKHEADER
// Get core.registered_on_punchplayers
@@ -77,8 +75,8 @@ bool ScriptApiPlayer::on_punchplayer(ServerActiveObject *player,
return readParam<bool>(L, -1);
}
-s32 ScriptApiPlayer::on_player_hpchange(ServerActiveObject *player,
- s32 hp_change, const PlayerHPChangeReason &reason)
+s32 ScriptApiPlayer::on_player_hpchange(ServerActiveObject *player, s32 hp_change,
+ const PlayerHPChangeReason &reason)
{
SCRIPTAPI_PRECHECKHEADER
@@ -115,9 +113,7 @@ bool ScriptApiPlayer::on_respawnplayer(ServerActiveObject *player)
}
bool ScriptApiPlayer::on_prejoinplayer(
- const std::string &name,
- const std::string &ip,
- std::string *reason)
+ const std::string &name, const std::string &ip, std::string *reason)
{
SCRIPTAPI_PRECHECKHEADER
@@ -163,8 +159,7 @@ void ScriptApiPlayer::on_joinplayer(ServerActiveObject *player, s64 last_login)
runCallbacks(2, RUN_CALLBACKS_MODE_FIRST);
}
-void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player,
- bool timeout)
+void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player, bool timeout)
{
SCRIPTAPI_PRECHECKHEADER
@@ -177,8 +172,7 @@ void ScriptApiPlayer::on_leaveplayer(ServerActiveObject *player,
runCallbacks(2, RUN_CALLBACKS_MODE_FIRST);
}
-void ScriptApiPlayer::on_cheat(ServerActiveObject *player,
- const std::string &cheat_type)
+void ScriptApiPlayer::on_cheat(ServerActiveObject *player, const std::string &cheat_type)
{
SCRIPTAPI_PRECHECKHEADER
@@ -194,8 +188,7 @@ void ScriptApiPlayer::on_cheat(ServerActiveObject *player,
}
void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
- const std::string &formname,
- const StringMap &fields)
+ const std::string &formname, const StringMap &fields)
{
SCRIPTAPI_PRECHECKHEADER
@@ -220,7 +213,8 @@ void ScriptApiPlayer::on_playerReceiveFields(ServerActiveObject *player,
runCallbacks(3, RUN_CALLBACKS_MODE_OR_SC);
}
-void ScriptApiPlayer::on_authplayer(const std::string &name, const std::string &ip, bool is_success)
+void ScriptApiPlayer::on_authplayer(
+ const std::string &name, const std::string &ip, bool is_success)
{
SCRIPTAPI_PRECHECKHEADER
@@ -236,13 +230,12 @@ void ScriptApiPlayer::on_authplayer(const std::string &name, const std::string &
}
void ScriptApiPlayer::pushMoveArguments(
- const MoveAction &ma, int count,
- ServerActiveObject *player)
+ const MoveAction &ma, int count, ServerActiveObject *player)
{
lua_State *L = getStack();
objectrefGetOrCreate(L, player); // player
- lua_pushstring(L, "move"); // action
- InvRef::create(L, ma.from_inv); // inventory
+ lua_pushstring(L, "move"); // action
+ InvRef::create(L, ma.from_inv); // inventory
lua_newtable(L);
{
// Table containing the action information
@@ -261,15 +254,14 @@ void ScriptApiPlayer::pushMoveArguments(
}
}
-void ScriptApiPlayer::pushPutTakeArguments(
- const char *method, const InventoryLocation &loc,
- const std::string &listname, int index, const ItemStack &stack,
- ServerActiveObject *player)
+void ScriptApiPlayer::pushPutTakeArguments(const char *method,
+ const InventoryLocation &loc, const std::string &listname, int index,
+ const ItemStack &stack, ServerActiveObject *player)
{
lua_State *L = getStack();
objectrefGetOrCreate(L, player); // player
- lua_pushstring(L, method); // action
- InvRef::create(L, loc); // inventory
+ lua_pushstring(L, method); // action
+ InvRef::create(L, loc); // inventory
lua_newtable(L);
{
// Table containing the action information
@@ -286,8 +278,7 @@ void ScriptApiPlayer::pushPutTakeArguments(
// Return number of accepted items to be moved
int ScriptApiPlayer::player_inventory_AllowMove(
- const MoveAction &ma, int count,
- ServerActiveObject *player)
+ const MoveAction &ma, int count, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
@@ -301,8 +292,7 @@ int ScriptApiPlayer::player_inventory_AllowMove(
// Return number of accepted items to be put
int ScriptApiPlayer::player_inventory_AllowPut(
- const MoveAction &ma, const ItemStack &stack,
- ServerActiveObject *player)
+ const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
@@ -316,8 +306,7 @@ int ScriptApiPlayer::player_inventory_AllowPut(
// Return number of accepted items to be taken
int ScriptApiPlayer::player_inventory_AllowTake(
- const MoveAction &ma, const ItemStack &stack,
- ServerActiveObject *player)
+ const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
@@ -331,8 +320,7 @@ int ScriptApiPlayer::player_inventory_AllowTake(
// Report moved items
void ScriptApiPlayer::player_inventory_OnMove(
- const MoveAction &ma, int count,
- ServerActiveObject *player)
+ const MoveAction &ma, int count, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
@@ -344,8 +332,7 @@ void ScriptApiPlayer::player_inventory_OnMove(
// Report put items
void ScriptApiPlayer::player_inventory_OnPut(
- const MoveAction &ma, const ItemStack &stack,
- ServerActiveObject *player)
+ const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER
@@ -357,8 +344,7 @@ void ScriptApiPlayer::player_inventory_OnPut(
// Report taken items
void ScriptApiPlayer::player_inventory_OnTake(
- const MoveAction &ma, const ItemStack &stack,
- ServerActiveObject *player)
+ const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
{
SCRIPTAPI_PRECHECKHEADER