forked from Mirrorlandia_minetest/minetest
Fix player double damage
This commit is contained in:
parent
c357985135
commit
2dc9a0c724
@ -566,7 +566,9 @@ void Client::step(float dtime)
|
|||||||
if(m_ignore_damage_timer <= 0)
|
if(m_ignore_damage_timer <= 0)
|
||||||
{
|
{
|
||||||
u8 damage = event.player_damage.amount;
|
u8 damage = event.player_damage.amount;
|
||||||
sendDamage(damage);
|
|
||||||
|
if(event.player_damage.send_to_server)
|
||||||
|
sendDamage(damage);
|
||||||
|
|
||||||
// Add to ClientEvent queue
|
// Add to ClientEvent queue
|
||||||
ClientEvent event;
|
ClientEvent event;
|
||||||
|
@ -1920,6 +1920,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
ClientEnvEvent event;
|
ClientEnvEvent event;
|
||||||
event.type = CEE_PLAYER_DAMAGE;
|
event.type = CEE_PLAYER_DAMAGE;
|
||||||
event.player_damage.amount = damage;
|
event.player_damage.amount = damage;
|
||||||
|
event.player_damage.send_to_server = true;
|
||||||
m_client_event_queue.push_back(event);
|
m_client_event_queue.push_back(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1953,6 +1954,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
ClientEnvEvent event;
|
ClientEnvEvent event;
|
||||||
event.type = CEE_PLAYER_DAMAGE;
|
event.type = CEE_PLAYER_DAMAGE;
|
||||||
event.player_damage.amount = damage_per_second;
|
event.player_damage.amount = damage_per_second;
|
||||||
|
event.player_damage.send_to_server = true;
|
||||||
m_client_event_queue.push_back(event);
|
m_client_event_queue.push_back(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2205,6 +2207,7 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
|
|||||||
ClientEnvEvent event;
|
ClientEnvEvent event;
|
||||||
event.type = CEE_PLAYER_DAMAGE;
|
event.type = CEE_PLAYER_DAMAGE;
|
||||||
event.player_damage.amount = damage;
|
event.player_damage.amount = damage;
|
||||||
|
event.player_damage.send_to_server = handle_hp;
|
||||||
m_client_event_queue.push_back(event);
|
m_client_event_queue.push_back(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,6 +368,7 @@ struct ClientEnvEvent
|
|||||||
} none;
|
} none;
|
||||||
struct{
|
struct{
|
||||||
u8 amount;
|
u8 amount;
|
||||||
|
bool send_to_server;
|
||||||
} player_damage;
|
} player_damage;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -2128,6 +2128,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
|
|
||||||
// Add PlayerSAO
|
// Add PlayerSAO
|
||||||
player->m_removed = false;
|
player->m_removed = false;
|
||||||
|
player->setId(0);
|
||||||
m_env->addActiveObject(player);
|
m_env->addActiveObject(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2887,6 +2888,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
<<PP(player->getPosition()/BS)<<std::endl;
|
<<PP(player->getPosition()/BS)<<std::endl;
|
||||||
|
|
||||||
srp->m_removed = false;
|
srp->m_removed = false;
|
||||||
|
srp->setId(0);
|
||||||
m_env->addActiveObject(srp);
|
m_env->addActiveObject(srp);
|
||||||
}
|
}
|
||||||
else if(command == TOSERVER_INTERACT)
|
else if(command == TOSERVER_INTERACT)
|
||||||
|
@ -142,8 +142,8 @@ void ServerRemotePlayer::punch(ServerActiveObject *puncher,
|
|||||||
// "Material" properties of a player
|
// "Material" properties of a player
|
||||||
MaterialProperties mp;
|
MaterialProperties mp;
|
||||||
mp.diggability = DIGGABLE_NORMAL;
|
mp.diggability = DIGGABLE_NORMAL;
|
||||||
mp.crackiness = -1.0;
|
mp.crackiness = -0.5;
|
||||||
mp.cuttability = 1.0;
|
mp.cuttability = 0.5;
|
||||||
|
|
||||||
ToolDiggingProperties tp;
|
ToolDiggingProperties tp;
|
||||||
puncher->getWieldDiggingProperties(&tp);
|
puncher->getWieldDiggingProperties(&tp);
|
||||||
|
Loading…
Reference in New Issue
Block a user