noFallDamage: fix wrong clientside hp #15

Closed
corarona wants to merge 1 commits from master into master
corarona commented 2020-11-18 05:35:49 -08:00 (Migrated from github.com)

This fixes damage on fall being reported clientside

Write a csm in df that does localplayer:get_hp() and see the hp stay at 0 when falling from something high.

This completely prevents the effects from fall damage.

This fixes damage on fall being reported clientside Write a csm in df that does localplayer:get_hp() and see the hp stay at 0 when falling from something high. This completely prevents the effects from fall damage.
LizzyFleckenstein03 (Migrated from github.com) requested changes 2020-11-20 02:50:57 -08:00
@ -491,2 +479,3 @@
if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
//if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
if (envEvent.player_damage.send_to_server)
LizzyFleckenstein03 (Migrated from github.com) commented 2020-11-20 02:49:47 -08:00

Please remove the comment.

Please remove the comment.
@ -282,3 +289,3 @@
u16 damage = (u16)MYMIN(damage_f + 0.5, U16_MAX);
if (damage != 0) {
if (!g_settings->getBool("prevent_natural_damage") != 0) {
damageLocalPlayer(damage, true);
LizzyFleckenstein03 (Migrated from github.com) commented 2020-11-20 02:50:40 -08:00

what is the != 0 for?

what is the != 0 for?
LizzyFleckenstein03 (Migrated from github.com) reviewed 2020-11-20 02:53:03 -08:00
@ -491,2 +479,3 @@
if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
//if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
if (envEvent.player_damage.send_to_server)
LizzyFleckenstein03 (Migrated from github.com) commented 2020-11-20 02:53:03 -08:00

Also, if (envEvent.player_damage.send_to_server) should stay as it's from minetest code and not a dragonfire addition.

Also, if (envEvent.player_damage.send_to_server) should stay as it's from minetest code and not a dragonfire addition.
LizzyFleckenstein03 (Migrated from github.com) reviewed 2020-11-20 02:53:48 -08:00
@ -282,3 +289,3 @@
u16 damage = (u16)MYMIN(damage_f + 0.5, U16_MAX);
if (damage != 0) {
if (!g_settings->getBool("prevent_natural_damage") != 0) {
damageLocalPlayer(damage, true);
LizzyFleckenstein03 (Migrated from github.com) commented 2020-11-20 02:53:48 -08:00

the check for damage != 0 should stay, its a minetest functionality.

the check for damage != 0 should stay, its a minetest functionality.
corarona (Migrated from github.com) reviewed 2020-11-20 15:20:55 -08:00
@ -491,2 +479,3 @@
if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
//if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
if (envEvent.player_damage.send_to_server)
corarona (Migrated from github.com) commented 2020-11-20 15:20:55 -08:00

mmh yeah i'll test those changes in a bit. I just more or less copied my original noFallDamage hack which was admittedly done with just about 0 knowledge of the codebase. We didn't find any regressions doing it this way tho. But yeah i'll have a look

EDIT:
Def better than having an inconsistent client state though ^^

mmh yeah i'll test those changes in a bit. I just more or less copied my original noFallDamage hack which was admittedly done with just about 0 knowledge of the codebase. We didn't find any regressions doing it this way tho. But yeah i'll have a look EDIT: Def better than having an inconsistent client state though ^^
corarona (Migrated from github.com) reviewed 2020-11-20 15:44:55 -08:00
@ -491,2 +479,3 @@
if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
//if (envEvent.player_damage.send_to_server && ! g_settings->getBool("prevent_natural_damage"))
if (envEvent.player_damage.send_to_server)
corarona (Migrated from github.com) commented 2020-11-20 15:44:55 -08:00

Well what can I say you're 100% right on both accounts .. this one should have the comment removed as you a said and the other one should say settings && damage !=0 sadly i cant seem to be able to commit anything to this rn .. github has somehow changed what repo i forked this from ... man this stuff is annoying lol

Well what can I say you're 100% right on both accounts .. this one should have the comment removed as you a said and the other one should say settings && damage !=0 sadly i cant seem to be able to commit anything to this rn .. github has somehow changed what repo i forked this from ... man this stuff is annoying lol
corarona (Migrated from github.com) reviewed 2020-11-20 15:45:58 -08:00
@ -282,3 +289,3 @@
u16 damage = (u16)MYMIN(damage_f + 0.5, U16_MAX);
if (damage != 0) {
if (!g_settings->getBool("prevent_natural_damage") != 0) {
damageLocalPlayer(damage, true);
corarona (Migrated from github.com) commented 2020-11-20 15:45:57 -08:00

yeah stupid, stupid cora :/

yeah stupid, stupid cora :/
corarona commented 2020-11-21 03:56:08 -08:00 (Migrated from github.com)

closed in shame. made a 2nd one with the correct changes lol

closed in shame. made a 2nd one with the correct changes lol

Pull request closed

Sign in to join this conversation.
There is no content yet.