summaryrefslogtreecommitdiffstats
path: root/src/Entities/SplashPotionEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-06-13 11:04:16 +0200
committerarchshift <admin@archshift.com>2014-06-17 20:39:21 +0200
commite289fe4dd7372a029ba85722e3ce99991e9d1d6b (patch)
tree1bc8ad0d0aa8a7e8685a53bddb0730c4a82122a4 /src/Entities/SplashPotionEntity.cpp
parentEntity Effect: Separates total duration and ticks of activity (diff)
downloadcuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar.gz
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar.bz2
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar.lz
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar.xz
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.tar.zst
cuberite-e289fe4dd7372a029ba85722e3ce99991e9d1d6b.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/SplashPotionEntity.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp
index 5574ea53c..4035b4794 100644
--- a/src/Entities/SplashPotionEntity.cpp
+++ b/src/Entities/SplashPotionEntity.cpp
@@ -67,20 +67,25 @@ cSplashPotionEntity::cSplashPotionCallback::cSplashPotionCallback(const Vector3d
bool cSplashPotionEntity::cSplashPotionCallback::Item(cEntity * a_Entity)
{
- double distance_splash = (a_Entity->GetPosition() - m_HitPos).Length();
- if (distance_splash < 20)
+ double SplashDistance = (a_Entity->GetPosition() - m_HitPos).Length();
+ if (SplashDistance < 20)
{
// y = -0.25x + 1, where x is the distance from the player. Approximation for potion splash.
// TODO: better equation
- double reduction = -0.25 * distance_splash + 1.0;
- if (reduction < 0) reduction = 0;
-
- m_EntityEffect.SetDistanceModifier(reduction);
+ double Reduction = -0.25 * SplashDistance + 1.0;
+ if (Reduction < 0)
+ {
+ Reduction = 0;
+ }
if (a_Entity->IsPawn())
{
- ((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect);
+ ((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.m_Ticks, m_EntityEffect.GetIntensity(), Reduction);
}
}
return false;
}
+
+
+
+