From 62c10e3d0855fa14fdc260da0b7cd748e53db13f Mon Sep 17 00:00:00 2001 From: lisacvuk Date: Tue, 23 Jan 2018 19:28:21 +0100 Subject: Disable fall damage when "immortal" group set (#6946) --- src/clientenvironment.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/clientenvironment.cpp') diff --git a/src/clientenvironment.cpp b/src/clientenvironment.cpp index af00586c5..8de073258 100644 --- a/src/clientenvironment.cpp +++ b/src/clientenvironment.cpp @@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "raycast.h" #include "voxelalgorithms.h" #include "settings.h" +#include "content_cao.h" #include #include "client/renderingengine.h" @@ -207,6 +208,8 @@ void ClientEnvironment::step(float dtime) //std::cout<<"Looped "<getCAO() && lplayer->getCAO()->isImmortal(); + for (const CollisionInfo &info : player_collisions) { v3f speed_diff = info.new_speed - info.old_speed;; // Handle only fall damage @@ -227,7 +230,7 @@ void ClientEnvironment::step(float dtime) pre_factor = 1.0 + (float)addp/100.0; } float speed = pre_factor * speed_diff.getLength(); - if (speed > tolerance) { + if (speed > tolerance && !player_immortal) { f32 damage_f = (speed - tolerance) / BS * post_factor; u8 damage = (u8)MYMIN(damage_f + 0.5, 255); if (damage != 0) { -- cgit v1.2.3