Implemented cacti damage
+ Implemented cacti damage * Fixed pickup tossing (PR #994 bug)
This commit is contained in:
parent
16dbad8107
commit
6167c79e7a
@ -816,9 +816,10 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
|
((a_Status == DIG_STATUS_STARTED) || (a_Status == DIG_STATUS_FINISHED)) && // Only do a radius check for block destruction - things like pickup tossing send coordinates that are to be ignored
|
||||||
|
((Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
|
||||||
(Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
|
(Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
|
||||||
(Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6)
|
(Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
|
m_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
|
||||||
|
@ -601,6 +601,10 @@ void cEntity::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
m_TicksSinceLastVoidDamage = 0;
|
m_TicksSinceLastVoidDamage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsMob() || IsPlayer() || IsPickup() || IsExpOrb())
|
||||||
|
{
|
||||||
|
DetectCacti();
|
||||||
|
}
|
||||||
if (IsMob() || IsPlayer())
|
if (IsMob() || IsPlayer())
|
||||||
{
|
{
|
||||||
// Set swimming state
|
// Set swimming state
|
||||||
@ -998,6 +1002,25 @@ void cEntity::TickInVoid(cChunk & a_Chunk)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cEntity::DetectCacti()
|
||||||
|
{
|
||||||
|
int X = POSX_TOINT, Y = POSY_TOINT, Z = POSZ_TOINT;
|
||||||
|
if (
|
||||||
|
((X + 1) - GetPosX() < 0.3) && (GetWorld()->GetBlock(X + 1, Y, Z) == E_BLOCK_CACTUS) ||
|
||||||
|
((GetPosX() - (X - 1)) - 1 < 0.3) && (GetWorld()->GetBlock(X - 1, Y, Z) == E_BLOCK_CACTUS) ||
|
||||||
|
((Z + 1) - GetPosZ() < 0.3) && (GetWorld()->GetBlock(X, Y, Z + 1) == E_BLOCK_CACTUS) ||
|
||||||
|
((GetPosZ() - (Z - 1)) - 1 < 0.3) && (GetWorld()->GetBlock(X, Y, Z - 1) == E_BLOCK_CACTUS) ||
|
||||||
|
(((Y > 0) && (Y < cChunkDef::Height)) && ((GetPosY() - Y < 1) && (GetWorld()->GetBlock(X, Y, Z) == E_BLOCK_CACTUS)))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
TakeDamage(dtCactus, NULL, 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cEntity::SetSwimState(cChunk & a_Chunk)
|
void cEntity::SetSwimState(cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
int RelY = (int)floor(GetPosY() + 0.1);
|
int RelY = (int)floor(GetPosY() + 0.1);
|
||||||
|
@ -317,6 +317,9 @@ public:
|
|||||||
|
|
||||||
/// Updates the state related to this entity being on fire
|
/// Updates the state related to this entity being on fire
|
||||||
virtual void TickBurning(cChunk & a_Chunk);
|
virtual void TickBurning(cChunk & a_Chunk);
|
||||||
|
|
||||||
|
/** Detects the time for application of cacti damage */
|
||||||
|
virtual void DetectCacti(void);
|
||||||
|
|
||||||
/// Handles when the entity is in the void
|
/// Handles when the entity is in the void
|
||||||
virtual void TickInVoid(cChunk & a_Chunk);
|
virtual void TickInVoid(cChunk & a_Chunk);
|
||||||
|
Loading…
Reference in New Issue
Block a user