summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 6da6da54e..c09317298 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -326,9 +326,32 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
m_Health = 0;
}
- if (IsMob() || IsPlayer()) // Knockback for only players and mobs
+ if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
{
- AddSpeed(a_TDI.Knockback * 2);
+ int KnockbackLevel = 0;
+ if (a_TDI.Attacker->GetEquippedWeapon().m_ItemType == E_ITEM_BOW)
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ }
+ else
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback);
+ }
+
+ Vector3d additionalSpeed(0, 0, 0);
+ switch (KnockbackLevel)
+ {
+ case 1:
+ additionalSpeed.Set(5, .2, 5);
+ break;
+ case 2:
+ additionalSpeed.Set(8, .2, 8);
+ break;
+ default:
+ additionalSpeed.Set(2, .2, 2);
+ break;
+ }
+ AddSpeed(a_TDI.Knockback * additionalSpeed);
}
m_World->BroadcastEntityStatus(*this, esGenericHurt);
@@ -773,14 +796,19 @@ void cEntity::TickBurning(cChunk & a_Chunk)
// Remember the current burning state:
bool HasBeenBurning = (m_TicksLeftBurning > 0);
- if (GetWorld()->GetWeather() == eWeather_Rain)
+ if (m_World->IsWeatherWet())
{
- if (HasBeenBurning)
+ int PosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width;
+ int PosY = POSY_TOINT;
+ int PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width;
+
+ if((POSY_TOINT - 1) == m_World->GetHeight(POSX_TOINT, POSZ_TOINT))
{
- m_TicksLeftBurning = 0;
- OnFinishedBurning();
- }
- return;
+ if (a_Chunk.GetSkyLight(PosX, PosY, PosZ) == 15)
+ {
+ m_TicksLeftBurning = 0;
+ }
+ }
}
// Do the burning damage: