summaryrefslogtreecommitdiff
path: root/src/serverremoteplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/serverremoteplayer.cpp')
-rw-r--r--src/serverremoteplayer.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/serverremoteplayer.cpp b/src/serverremoteplayer.cpp
index 728ffe026..8a81f1d2d 100644
--- a/src/serverremoteplayer.cpp
+++ b/src/serverremoteplayer.cpp
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gamedef.h"
#include "inventory.h"
#include "environment.h"
-#include "materials.h"
+#include "tool.h"
ServerRemotePlayer::ServerRemotePlayer(ServerEnvironment *env):
Player(env->getGameDef()),
@@ -181,35 +181,32 @@ void ServerRemotePlayer::punch(ServerActiveObject *puncher,
return;
}
- // "Material" properties of a player
- MaterialProperties mp;
- mp.diggability = DIGGABLE_NORMAL;
- mp.crackiness = -0.5;
- mp.cuttability = 0.5;
+ // "Material" groups of the player
+ std::map<std::string, int> groups;
+ groups["snappy"] = 1;
+ groups["choppy"] = 2;
IItemDefManager *idef = m_env->getGameDef()->idef();
ItemStack punchitem = puncher->getWieldedItem();
- ToolDiggingProperties tp =
- punchitem.getToolDiggingProperties(idef);
+ ToolCapabilities tp = punchitem.getToolCapabilities(idef);
- HittingProperties hitprop = getHittingProperties(&mp, &tp,
- time_from_last_punch);
+ HitParams hitparams = getHitParams(groups, &tp, time_from_last_punch);
actionstream<<"Player "<<getName()<<" punched by "
- <<puncher->getDescription()<<", damage "<<hitprop.hp
+ <<puncher->getDescription()<<", damage "<<hitparams.hp
<<" HP"<<std::endl;
- setHP(getHP() - hitprop.hp);
- punchitem.addWear(hitprop.wear, idef);
+ setHP(getHP() - hitparams.hp);
+ punchitem.addWear(hitparams.wear, idef);
puncher->setWieldedItem(punchitem);
- if(hitprop.hp != 0)
+ if(hitparams.hp != 0)
{
std::ostringstream os(std::ios::binary);
// command (1 = punched)
writeU8(os, 1);
// damage
- writeS16(os, hitprop.hp);
+ writeS16(os, hitparams.hp);
// create message and add to list
ActiveObjectMessage aom(getId(), false, os.str());
m_messages_out.push_back(aom);