From 143a5e61fc8e704f3df776d089217f031bc47779 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 5 Apr 2014 22:34:05 +0200 Subject: Fixed Endiannes conversion routines for floats and doubles. This bug has been introduced in 8825d30aabbee8cb2e452dc5a17deb6f9b6892a7. This change fixes #854. --- src/Entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 221cbbea7..8ef45f1a5 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1469,7 +1469,7 @@ void cEntity::SteerVehicle(float a_Forward, float a_Sideways) Vector3d cEntity::GetLookVector(void) const { Matrix4d m; - m.Init(Vector3f(), 0, m_Rot.x, -m_Rot.y); + m.Init(Vector3d(), 0, m_Rot.x, -m_Rot.y); Vector3d Look = m.Transform(Vector3d(0, 0, 1)); return Look; } -- cgit v1.2.3 From c0c47d33c571bde4cfb45043b645b3d45c3223e6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 12 Apr 2014 13:16:48 +0100 Subject: Entities handle chunks properly again * Entities properly handle chunks * Changed EntityStatus enums to be less shouty --- src/Entities/Entity.cpp | 115 +++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 66 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 8ef45f1a5..aa07527d0 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -330,7 +330,7 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) AddSpeed(a_TDI.Knockback * 2); } - m_World->BroadcastEntityStatus(*this, ENTITY_STATUS_HURT); + m_World->BroadcastEntityStatus(*this, esGenericHurt); if (m_Health <= 0) { @@ -479,7 +479,7 @@ void cEntity::KilledBy(cEntity * a_Killer) GetDrops(Drops, a_Killer); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ()); - m_World->BroadcastEntityStatus(*this, ENTITY_STATUS_DEAD); + m_World->BroadcastEntityStatus(*this, esGenericDead); } @@ -519,37 +519,36 @@ void cEntity::Tick(float a_Dt, cChunk & a_Chunk) } else { - if (a_Chunk.IsValid()) + if (!a_Chunk.IsValid()) { - cChunk * NextChunk = a_Chunk.GetNeighborChunk(POSX_TOINT, POSZ_TOINT); + return; + } - if ((NextChunk == NULL) || !NextChunk->IsValid()) - { - return; - } + // Position changed -> super::Tick() called + GET_AND_VERIFY_CURRENT_CHUNK(NextChunk, POSX_TOINT, POSZ_TOINT) - TickBurning(*NextChunk); + TickBurning(*NextChunk); - if (GetPosY() < VOID_BOUNDARY) - { - TickInVoid(*NextChunk); - } - else - { - m_TicksSinceLastVoidDamage = 0; - } - - if (IsMob() || IsPlayer()) - { - // Set swimming state - SetSwimState(*NextChunk); + if (GetPosY() < VOID_BOUNDARY) + { + TickInVoid(*NextChunk); + } + else + { + m_TicksSinceLastVoidDamage = 0; + } - // Handle drowning - HandleAir(); - } + if (IsMob() || IsPlayer()) + { + // Set swimming state + SetSwimState(*NextChunk); - HandlePhysics(a_Dt, *NextChunk); + // Handle drowning + HandleAir(); } + + // None of the above functions change position, we remain in the chunk of NextChunk + HandlePhysics(a_Dt, *NextChunk); } } @@ -559,34 +558,30 @@ void cEntity::Tick(float a_Dt, cChunk & a_Chunk) void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) { + int BlockX = POSX_TOINT; + int BlockY = POSY_TOINT; + int BlockZ = POSZ_TOINT; + + // Position changed -> super::HandlePhysics() called + GET_AND_VERIFY_CURRENT_CHUNK(NextChunk, BlockX, BlockZ) + // TODO Add collision detection with entities. a_Dt /= 1000; // Convert from msec to sec - Vector3d NextPos = Vector3d(GetPosX(),GetPosY(),GetPosZ()); - Vector3d NextSpeed = Vector3d(GetSpeedX(),GetSpeedY(),GetSpeedZ()); - int BlockX = (int) floor(NextPos.x); - int BlockY = (int) floor(NextPos.y); - int BlockZ = (int) floor(NextPos.z); + Vector3d NextPos = Vector3d(GetPosX(), GetPosY(), GetPosZ()); + Vector3d NextSpeed = Vector3d(GetSpeedX(), GetSpeedY(), GetSpeedZ()); if ((BlockY >= cChunkDef::Height) || (BlockY < 0)) { - // Outside of the world - - cChunk * NextChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ); - // See if we can commit our changes. If not, we will discard them. - if (NextChunk != NULL) - { - SetSpeed(NextSpeed); - NextPos += (NextSpeed * a_Dt); - SetPosition(NextPos); - } - + // Outside of the world + AddSpeedY(m_Gravity * a_Dt); + AddPosition(GetSpeed() * a_Dt); return; } - int RelBlockX = BlockX - (a_Chunk.GetPosX() * cChunkDef::Width); - int RelBlockZ = BlockZ - (a_Chunk.GetPosZ() * cChunkDef::Width); - BLOCKTYPE BlockIn = a_Chunk.GetBlock( RelBlockX, BlockY, RelBlockZ ); - BLOCKTYPE BlockBelow = (BlockY > 0) ? a_Chunk.GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR; + int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width); + int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width); + BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ ); + BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR; if (!cBlockInfo::IsSolid(BlockIn)) // Making sure we are not inside a solid block { if (m_bOnGround) // check if it's still on the ground @@ -616,7 +611,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) bool IsNoAirSurrounding = true; for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) { - if (!a_Chunk.UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock)) + if (!NextChunk->UnboundedRelGetBlockType(RelBlockX + gCrossCoords[i].x, BlockY, RelBlockZ + gCrossCoords[i].z, GotBlock)) { // The pickup is too close to an unloaded chunk, bail out of any physics handling return; @@ -764,20 +759,8 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) } } - BlockX = (int) floor(NextPos.x); - BlockZ = (int) floor(NextPos.z); - - cChunk * NextChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ); - // See if we can commit our changes. If not, we will discard them. - if (NextChunk != NULL) - { - if (NextPos.x != GetPosX()) SetPosX(NextPos.x); - if (NextPos.y != GetPosY()) SetPosY(NextPos.y); - if (NextPos.z != GetPosZ()) SetPosZ(NextPos.z); - if (NextSpeed.x != GetSpeedX()) SetSpeedX(NextSpeed.x); - if (NextSpeed.y != GetSpeedY()) SetSpeedY(NextSpeed.y); - if (NextSpeed.z != GetSpeedZ()) SetSpeedZ(NextSpeed.z); - } + SetPosition(NextPos); + SetSpeed(NextSpeed); } @@ -981,13 +964,13 @@ void cEntity::HandleAir(void) } else { - m_AirTickTimer -= 1; + m_AirTickTimer--; } } else { // Reduce air supply - m_AirLevel -= 1; + m_AirLevel--; } } else @@ -1099,15 +1082,15 @@ void cEntity::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude) { - //We need to keep updating the clients when there is movement or if there was a change in speed and after 2 ticks - if( (m_Speed.SqrLength() > 0.0004f || m_bDirtySpeed) && (m_World->GetWorldAge() - m_TimeLastSpeedPacket >= 2)) + // Send velocity packet every two ticks if: speed is not negligible or speed was set (as indicated by the DirtySpeed flag) + if (((m_Speed.SqrLength() > 0.0004f) || m_bDirtySpeed) && ((m_World->GetWorldAge() - m_TimeLastSpeedPacket) >= 2)) { m_World->BroadcastEntityVelocity(*this,a_Exclude); m_bDirtySpeed = false; m_TimeLastSpeedPacket = m_World->GetWorldAge(); } - //Have to process position related packets this every two ticks + // Have to process position related packets this every two ticks if (m_World->GetWorldAge() % 2 == 0) { int DiffX = (int) (floor(GetPosX() * 32.0) - floor(m_LastPosX * 32.0)); -- cgit v1.2.3 From bdea8706d8050ba3ea00b580bba795bc468cfdbd Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 17 Apr 2014 18:50:25 +0100 Subject: Added new AI rules + Added new AI rules handling cacti and large heights * Fixed cIniFile not recognising comments in cIniFile::ReadFile() * Fixed users.ini not being properly generated * Changed all instances of (int)floor(GetPosXXX()) to POSXXX_TOINT --- src/Entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 8ef45f1a5..7d9039479 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -806,7 +806,7 @@ void cEntity::TickBurning(cChunk & a_Chunk) int MaxRelX = (int)floor(GetPosX() + m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width; int MinRelZ = (int)floor(GetPosZ() - m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width; int MaxRelZ = (int)floor(GetPosZ() + m_Width / 2) - a_Chunk.GetPosZ() * cChunkDef::Width; - int MinY = std::max(0, std::min(cChunkDef::Height - 1, (int)floor(GetPosY()))); + int MinY = std::max(0, std::min(cChunkDef::Height - 1, POSY_TOINT)); int MaxY = std::max(0, std::min(cChunkDef::Height - 1, (int)ceil (GetPosY() + m_Height))); bool HasWater = false; bool HasLava = false; -- cgit v1.2.3 From 6cb63a768dd2356d0e41aef1ef086ae972449bdd Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 18 Apr 2014 12:59:14 +0100 Subject: Fixed #906 --- src/Entities/Entity.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 86aee4c6f..56ef36ef8 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -771,6 +771,16 @@ void cEntity::TickBurning(cChunk & a_Chunk) { // Remember the current burning state: bool HasBeenBurning = (m_TicksLeftBurning > 0); + + if (GetWorld()->GetWeather() == eWeather_Rain) + { + if (HasBeenBurning) + { + m_TicksLeftBurning = 0; + OnFinishedBurning(); + } + return; + } // Do the burning damage: if (m_TicksLeftBurning > 0) -- cgit v1.2.3 From a967313839bab2a5f43befabe689801b949b274e Mon Sep 17 00:00:00 2001 From: "r.ramazanov" Date: Mon, 21 Apr 2014 13:13:25 +0400 Subject: Mobs shouldn't burn when it's Raining #906 --- src/Entities/Entity.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 56ef36ef8..c1926dafc 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -774,12 +774,19 @@ void cEntity::TickBurning(cChunk & a_Chunk) if (GetWorld()->GetWeather() == eWeather_Rain) { - if (HasBeenBurning) + + int PosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width, + PosY = POSY_TOINT, + PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; + + if ((PosY > 0) || (PosY <= cChunkDef::Height)) { - m_TicksLeftBurning = 0; - OnFinishedBurning(); - } - return; + // Inside the world + if (a_Chunk.GetSkyLight(PosX, PosY, PosZ) == 15) + { + m_TicksLeftBurning = 0; + } + } } // Do the burning damage: -- cgit v1.2.3 From bca7f2949032ab90ee03988f560bce157a25b683 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 01:59:34 -1000 Subject: Lay foundation for fireproof entities. Prevent any entities with the m_Fireproof flag from taking fire or lava damage. --- src/Entities/Entity.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 56ef36ef8..345e0054b 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -788,7 +788,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastBurnDamage++; if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { - TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + } m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; @@ -856,7 +859,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastLavaDamage++; if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { - TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + } m_TicksSinceLastLavaDamage = 0; } } @@ -874,7 +880,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastFireDamage++; if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { - TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + } m_TicksSinceLastFireDamage = 0; } } -- cgit v1.2.3 From 06f41699afe27a6be1de357466f9185403baa550 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 02:36:39 -1000 Subject: Fixed indentation and changed m_Fireproof to m_IsFireproof. --- src/Entities/Entity.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 345e0054b..9a80d3e80 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -788,10 +788,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastBurnDamage++; if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + } m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; @@ -859,10 +859,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastLavaDamage++; if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + } m_TicksSinceLastLavaDamage = 0; } } @@ -880,10 +880,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastFireDamage++; if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + } m_TicksSinceLastFireDamage = 0; } } -- cgit v1.2.3 From a37b36adab85206e025d4ca97f6e64dc7a6974b8 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 12:59:31 -1000 Subject: Fireproof status getter and setter. --- src/Entities/Entity.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 9a80d3e80..82900ff91 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -45,6 +45,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d , m_IsInitialized(false) , m_EntityType(a_EntityType) , m_World(NULL) + , m_IsFireproof(false) , m_TicksSinceLastBurnDamage(0) , m_TicksSinceLastLavaDamage(0) , m_TicksSinceLastFireDamage(0) @@ -1042,6 +1043,16 @@ void cEntity::SetMaxHealth(int a_MaxHealth) +/// Sets whether the entity is fireproof +void cEntity::SetFireproofStatus(bool a_IsFireproof) +{ + m_IsFireproof = a_IsFireproof; +} + + + + + /// Puts the entity on fire for the specified amount of ticks void cEntity::StartBurning(int a_TicksLeftBurning) { -- cgit v1.2.3 From 876866942807f823d5d7553538f562a6b081093b Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 23 Apr 2014 00:12:37 -0700 Subject: Renamed getter and setter for IsFireproof. --- src/Entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 82900ff91..6da6da54e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1044,7 +1044,7 @@ void cEntity::SetMaxHealth(int a_MaxHealth) /// Sets whether the entity is fireproof -void cEntity::SetFireproofStatus(bool a_IsFireproof) +void cEntity::SetIsFireproof(bool a_IsFireproof) { m_IsFireproof = a_IsFireproof; } -- cgit v1.2.3 From 5deb35c5cfc97fc07601fb64ce9631c794237680 Mon Sep 17 00:00:00 2001 From: "r.ramazanov" Date: Wed, 23 Apr 2014 18:15:04 +0400 Subject: Mobs shouldn't burn when it's Raining #906 Mob Knockback is far too much #776 --- src/Entities/Entity.cpp | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index c1926dafc..46bb499b4 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -325,9 +325,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); @@ -772,16 +795,14 @@ 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()) { + int PosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width; + int PosY = POSY_TOINT; + int PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; - int PosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width, - PosY = POSY_TOINT, - PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; - - if ((PosY > 0) || (PosY <= cChunkDef::Height)) + if((POSY_TOINT - 1) == m_World->GetHeight(POSX_TOINT, POSZ_TOINT)) { - // Inside the world if (a_Chunk.GetSkyLight(PosX, PosY, PosZ) == 15) { m_TicksLeftBurning = 0; -- cgit v1.2.3 From a72744f5c33ec11f33637839e4d6206c4aa2fa2a Mon Sep 17 00:00:00 2001 From: "r.ramazanov" Date: Fri, 25 Apr 2014 10:08:36 +0400 Subject: Mobs shouldn't burn when it's Raining & Mob Knockback is far too much --- src/Entities/Entity.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index c09317298..89275a418 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -342,13 +342,13 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) switch (KnockbackLevel) { case 1: - additionalSpeed.Set(5, .2, 5); + additionalSpeed.Set(5, .3, 5); break; case 2: - additionalSpeed.Set(8, .2, 8); + additionalSpeed.Set(8, .3, 8); break; default: - additionalSpeed.Set(2, .2, 2); + additionalSpeed.Set(2, .3, 2); break; } AddSpeed(a_TDI.Knockback * additionalSpeed); @@ -802,12 +802,9 @@ void cEntity::TickBurning(cChunk & a_Chunk) int PosY = POSY_TOINT; int PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; - if((POSY_TOINT - 1) == m_World->GetHeight(POSX_TOINT, POSZ_TOINT)) + if (PosY > m_World->GetHeight(POSX_TOINT, POSZ_TOINT)) { - if (a_Chunk.GetSkyLight(PosX, PosY, PosZ) == 15) - { - m_TicksLeftBurning = 0; - } + m_TicksLeftBurning = 0; } } -- cgit v1.2.3 From 827c3760db5da766a99c42312aa95b43dded9436 Mon Sep 17 00:00:00 2001 From: "r.ramazanov" Date: Fri, 25 Apr 2014 10:58:48 +0400 Subject: Fix for clang --- src/Entities/Entity.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 89275a418..402f94d08 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -798,11 +798,7 @@ void cEntity::TickBurning(cChunk & a_Chunk) if (m_World->IsWeatherWet()) { - int PosX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width; - int PosY = POSY_TOINT; - int PosZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; - - if (PosY > m_World->GetHeight(POSX_TOINT, POSZ_TOINT)) + if (POSY_TOINT > m_World->GetHeight(POSX_TOINT, POSZ_TOINT)) { m_TicksLeftBurning = 0; } -- cgit v1.2.3 From 4cd2d57c643ec2c7dab7a664248dbf65254c1b1d Mon Sep 17 00:00:00 2001 From: "r.ramazanov" Date: Fri, 25 Apr 2014 12:06:22 +0400 Subject: Fix formatting --- src/Entities/Entity.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 402f94d08..d0dd6fb50 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -341,15 +341,21 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) Vector3d additionalSpeed(0, 0, 0); switch (KnockbackLevel) { - case 1: - additionalSpeed.Set(5, .3, 5); - break; - case 2: - additionalSpeed.Set(8, .3, 8); - break; - default: - additionalSpeed.Set(2, .3, 2); - break; + case 1: + { + additionalSpeed.Set(5, .3, 5); + break; + } + case 2: + { + additionalSpeed.Set(8, .3, 8); + break; + } + default: + { + additionalSpeed.Set(2, .3, 2); + break; + } } AddSpeed(a_TDI.Knockback * additionalSpeed); } -- cgit v1.2.3