mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make hitting players make a visual damage flash to the player texture and the screen of the local player
This commit is contained in:
parent
ae2b7f9523
commit
c357985135
2 changed files with 29 additions and 8 deletions
|
@ -151,10 +151,19 @@ void ServerRemotePlayer::punch(ServerActiveObject *puncher,
|
|||
HittingProperties hitprop = getHittingProperties(&mp, &tp,
|
||||
time_from_last_punch);
|
||||
|
||||
infostream<<"1. getHP()="<<getHP()<<std::endl;
|
||||
setHP(getHP() - hitprop.hp);
|
||||
infostream<<"2. getHP()="<<getHP()<<std::endl;
|
||||
puncher->damageWieldedItem(hitprop.wear);
|
||||
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command (1 = punched)
|
||||
writeU8(os, 1);
|
||||
// damage
|
||||
writeS16(os, hitprop.hp);
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), false, os.str());
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerRemotePlayer::rightClick(ServerActiveObject *clicker)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue