#include "raycast.h"
#include "voxelalgorithms.h"
#include "settings.h"
+#include "content_cao.h"
#include <algorithm>
#include "client/renderingengine.h"
//std::cout<<"Looped "<<loopcount<<" times."<<std::endl;
+ bool player_immortal = lplayer->getCAO() && lplayer->getCAO()->isImmortal();
+
for (const CollisionInfo &info : player_collisions) {
v3f speed_diff = info.new_speed - info.old_speed;;
// Handle only fall damage
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) {
return pos_translator.vect_show;
}
+const bool GenericCAO::isImmortal()
+{
+ return itemgroup_get(getGroups(), "immortal");
+}
+
scene::ISceneNode* GenericCAO::getSceneNode()
{
if (m_meshnode) {
{
return ACTIVEOBJECT_TYPE_GENERIC;
}
-
+ inline const ItemGroupList &getGroups() const
+ {
+ return m_armor_groups;
+ }
void initialize(const std::string &data);
void processInitData(const std::string &data);
return m_yaw;
}
+ const bool isImmortal();
+
scene::ISceneNode *getSceneNode();
scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode();