aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/environment.cpp3
-rw-r--r--src/environment.h1
-rw-r--r--src/server.cpp2
-rw-r--r--src/serverremoteplayer.cpp4
5 files changed, 11 insertions, 3 deletions
diff --git a/src/client.cpp b/src/client.cpp
index d264713e2..d092c6a10 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -566,7 +566,9 @@ void Client::step(float dtime)
if(m_ignore_damage_timer <= 0)
{
u8 damage = event.player_damage.amount;
- sendDamage(damage);
+
+ if(event.player_damage.send_to_server)
+ sendDamage(damage);
// Add to ClientEvent queue
ClientEvent event;
diff --git a/src/environment.cpp b/src/environment.cpp
index ce81a1941..67ea05cf6 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -1920,6 +1920,7 @@ void ClientEnvironment::step(float dtime)
ClientEnvEvent event;
event.type = CEE_PLAYER_DAMAGE;
event.player_damage.amount = damage;
+ event.player_damage.send_to_server = true;
m_client_event_queue.push_back(event);
}
}
@@ -1953,6 +1954,7 @@ void ClientEnvironment::step(float dtime)
ClientEnvEvent event;
event.type = CEE_PLAYER_DAMAGE;
event.player_damage.amount = damage_per_second;
+ event.player_damage.send_to_server = true;
m_client_event_queue.push_back(event);
}
}
@@ -2205,6 +2207,7 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
ClientEnvEvent event;
event.type = CEE_PLAYER_DAMAGE;
event.player_damage.amount = damage;
+ event.player_damage.send_to_server = handle_hp;
m_client_event_queue.push_back(event);
}
diff --git a/src/environment.h b/src/environment.h
index 2cdfb4b48..7759d43af 100644
--- a/src/environment.h
+++ b/src/environment.h
@@ -368,6 +368,7 @@ struct ClientEnvEvent
} none;
struct{
u8 amount;
+ bool send_to_server;
} player_damage;
};
};
diff --git a/src/server.cpp b/src/server.cpp
index 361be9efd..f12fd261e 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2128,6 +2128,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Add PlayerSAO
player->m_removed = false;
+ player->setId(0);
m_env->addActiveObject(player);
/*
@@ -2887,6 +2888,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
<<PP(player->getPosition()/BS)<<std::endl;
srp->m_removed = false;
+ srp->setId(0);
m_env->addActiveObject(srp);
}
else if(command == TOSERVER_INTERACT)
diff --git a/src/serverremoteplayer.cpp b/src/serverremoteplayer.cpp
index ceb46c4ee..c5033da50 100644
--- a/src/serverremoteplayer.cpp
+++ b/src/serverremoteplayer.cpp
@@ -142,8 +142,8 @@ void ServerRemotePlayer::punch(ServerActiveObject *puncher,
// "Material" properties of a player
MaterialProperties mp;
mp.diggability = DIGGABLE_NORMAL;
- mp.crackiness = -1.0;
- mp.cuttability = 1.0;
+ mp.crackiness = -0.5;
+ mp.cuttability = 0.5;
ToolDiggingProperties tp;
puncher->getWieldDiggingProperties(&tp);