summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-12 08:41:33 +0100
committermadmaxoft <github@xoft.cz>2014-03-12 08:41:33 +0100
commit392fb7923b2a1a94dc417b7578460e32fa72dcd9 (patch)
treeb80dfb455781c900c34cb64ac1a6b341a9696bf2 /src
parentAPIDump: Removed old documentation, documented some new functions. (diff)
parentTakeDamage now has the cThrownSnowballEntity instead of the creator's object. (diff)
downloadcuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar.gz
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar.bz2
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar.lz
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar.xz
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.tar.zst
cuberite-392fb7923b2a1a94dc417b7578460e32fa72dcd9.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/ProjectileEntity.cpp26
-rw-r--r--src/Entities/ProjectileEntity.h1
2 files changed, 25 insertions, 2 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 12d2025ec..f4ab825f2 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -663,8 +663,6 @@ cThrownSnowballEntity::cThrownSnowballEntity(cEntity * a_Creator, double a_X, do
void cThrownSnowballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
- // TODO: Apply damage to certain mobs (blaze etc.) and anger all mobs
-
Destroy();
}
@@ -672,6 +670,30 @@ void cThrownSnowballEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFac
+void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
+{
+ int TotalDamage = 0;
+ if (a_EntityHit.IsMob())
+ {
+ cMonster::eType MobType = ((cMonster &) a_EntityHit).GetMobType();
+ if (MobType == cMonster::mtBlaze)
+ {
+ TotalDamage = 3;
+ }
+ else if (MobType == cMonster::mtEnderDragon)
+ {
+ TotalDamage = 1;
+ }
+ }
+ a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
+
+ Destroy(true);
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cBottleOEnchantingEntity :
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index fac592d16..efb7ae783 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -259,6 +259,7 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
+ virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
// tolua_begin