From 562ac3bce9fae076562bd2e92e7d330c296ac1b0 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 28 Feb 2012 19:45:23 +0200 Subject: Digging time groups WIP --- src/serverremoteplayer.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/serverremoteplayer.cpp') 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 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 "<getDescription()<<", damage "<getDescription()<<", damage "<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); -- cgit v1.2.3