1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Consistent HP and damage types (#8167)

Remove deprecated HUDs and chat message handling.
Remove unused m_damage variable (compat break).
HP: s32 for setter/calculations, u16 for getter.
This commit is contained in:
SmallJoker 2019-02-11 00:03:26 +01:00 committed by Paramat
parent ba5a9f2b36
commit ffb17f1c9a
25 changed files with 67 additions and 136 deletions

View file

@ -228,7 +228,7 @@ void ClientEnvironment::step(float dtime)
float speed = pre_factor * speed_diff.getLength();
if (speed > tolerance && !player_immortal) {
f32 damage_f = (speed - tolerance) / BS * post_factor;
u8 damage = (u8)MYMIN(damage_f + 0.5, 255);
u16 damage = (u16)MYMIN(damage_f + 0.5, U16_MAX);
if (damage != 0) {
damageLocalPlayer(damage, true);
m_client->getEventManager()->put(
@ -419,7 +419,7 @@ void ClientEnvironment::processActiveObjectMessage(u16 id, const std::string &da
Callbacks for activeobjects
*/
void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
void ClientEnvironment::damageLocalPlayer(u16 damage, bool handle_hp)
{
LocalPlayer *lplayer = getLocalPlayer();
assert(lplayer);