Prevent fall damage from overflowing when falling from a large height. (#5791)
parent
4dc97eb99f
commit
ae483f1bd0
|
@ -237,11 +237,10 @@ void ClientEnvironment::step(float dtime)
|
||||||
pre_factor = 1.0 + (float)addp/100.0;
|
pre_factor = 1.0 + (float)addp/100.0;
|
||||||
}
|
}
|
||||||
float speed = pre_factor * speed_diff.getLength();
|
float speed = pre_factor * speed_diff.getLength();
|
||||||
if(speed > tolerance)
|
if (speed > tolerance) {
|
||||||
{
|
f32 damage_f = (speed - tolerance) / BS * post_factor;
|
||||||
f32 damage_f = (speed - tolerance)/BS * post_factor;
|
u8 damage = (u8)MYMIN(damage_f + 0.5, 255);
|
||||||
u16 damage = (u16)(damage_f+0.5);
|
if (damage != 0) {
|
||||||
if(damage != 0){
|
|
||||||
damageLocalPlayer(damage, true);
|
damageLocalPlayer(damage, true);
|
||||||
MtEvent *e = new SimpleTriggerEvent("PlayerFallingDamage");
|
MtEvent *e = new SimpleTriggerEvent("PlayerFallingDamage");
|
||||||
m_client->event()->put(e);
|
m_client->event()->put(e);
|
||||||
|
|
Loading…
Reference in New Issue