aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/luaentity_sao.cpp8
-rw-r--r--src/server/luaentity_sao.h5
-rw-r--r--src/server/player_sao.cpp7
-rw-r--r--src/server/player_sao.h4
-rw-r--r--src/server/serveractiveobject.h7
5 files changed, 18 insertions, 13 deletions
diff --git a/src/server/luaentity_sao.cpp b/src/server/luaentity_sao.cpp
index 1d65ac306..82f6da231 100644
--- a/src/server/luaentity_sao.cpp
+++ b/src/server/luaentity_sao.cpp
@@ -305,10 +305,11 @@ void LuaEntitySAO::getStaticData(std::string *result) const
*result = os.str();
}
-u16 LuaEntitySAO::punch(v3f dir,
+u32 LuaEntitySAO::punch(v3f dir,
const ToolCapabilities *toolcap,
ServerActiveObject *puncher,
- float time_from_last_punch)
+ float time_from_last_punch,
+ u16 initial_wear)
{
if (!m_registered) {
// Delete unknown LuaEntities when punched
@@ -326,7 +327,8 @@ u16 LuaEntitySAO::punch(v3f dir,
m_armor_groups,
toolcap,
&tool_item,
- time_from_last_punch);
+ time_from_last_punch,
+ initial_wear);
bool damage_handled = m_env->getScriptIface()->luaentity_Punch(m_id, puncher,
time_from_last_punch, toolcap, dir, result.did_punch ? result.damage : 0);
diff --git a/src/server/luaentity_sao.h b/src/server/luaentity_sao.h
index 6883ae1b9..87b664a8b 100644
--- a/src/server/luaentity_sao.h
+++ b/src/server/luaentity_sao.h
@@ -44,9 +44,10 @@ public:
bool isStaticAllowed() const { return m_prop.static_save; }
bool shouldUnload() const { return true; }
void getStaticData(std::string *result) const;
- u16 punch(v3f dir, const ToolCapabilities *toolcap = nullptr,
+ u32 punch(v3f dir, const ToolCapabilities *toolcap = nullptr,
ServerActiveObject *puncher = nullptr,
- float time_from_last_punch = 1000000.0f);
+ float time_from_last_punch = 1000000.0f,
+ u16 initial_wear = 0);
void rightClick(ServerActiveObject *clicker);
void setPos(const v3f &pos);
void moveTo(v3f pos, bool continuous);
diff --git a/src/server/player_sao.cpp b/src/server/player_sao.cpp
index 690823bb7..83e17f830 100644
--- a/src/server/player_sao.cpp
+++ b/src/server/player_sao.cpp
@@ -409,10 +409,11 @@ void PlayerSAO::setLookPitchAndSend(const float pitch)
m_env->getGameDef()->SendMovePlayer(m_peer_id);
}
-u16 PlayerSAO::punch(v3f dir,
+u32 PlayerSAO::punch(v3f dir,
const ToolCapabilities *toolcap,
ServerActiveObject *puncher,
- float time_from_last_punch)
+ float time_from_last_punch,
+ u16 initial_wear)
{
if (!toolcap)
return 0;
@@ -430,7 +431,7 @@ u16 PlayerSAO::punch(v3f dir,
s32 old_hp = getHP();
HitParams hitparams = getHitParams(m_armor_groups, toolcap,
- time_from_last_punch);
+ time_from_last_punch, initial_wear);
PlayerSAO *playersao = m_player->getPlayerSAO();
diff --git a/src/server/player_sao.h b/src/server/player_sao.h
index 1429d7129..47fe85413 100644
--- a/src/server/player_sao.h
+++ b/src/server/player_sao.h
@@ -109,8 +109,8 @@ public:
Interaction interface
*/
- u16 punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher,
- float time_from_last_punch);
+ u32 punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher,
+ float time_from_last_punch, u16 initial_wear = 0);
void rightClick(ServerActiveObject *clicker);
void setHP(s32 hp, const PlayerHPChangeReason &reason) override
{
diff --git a/src/server/serveractiveobject.h b/src/server/serveractiveobject.h
index 51f445914..5b0ee2d9b 100644
--- a/src/server/serveractiveobject.h
+++ b/src/server/serveractiveobject.h
@@ -145,11 +145,12 @@ public:
virtual bool shouldUnload() const
{ return true; }
- // Returns tool wear
- virtual u16 punch(v3f dir,
+ // Returns added tool wear
+ virtual u32 punch(v3f dir,
const ToolCapabilities *toolcap = nullptr,
ServerActiveObject *puncher = nullptr,
- float time_from_last_punch = 1000000.0f)
+ float time_from_last_punch = 1000000.0f,
+ u16 initial_wear = 0)
{ return 0; }
virtual void rightClick(ServerActiveObject *clicker)
{}