1
0

Exp Orbs and Pickups are destroyed instantly by cacti. (#4136)

* Cactus detection code follows pattern set in #3996

* Pickups are now destroyed on cactus contact

* Add cactus detection and destruction to Exp Orbs

Remove checks for IsExpOrb() in cEntity::Tick()

Exp Orbs do not call super::Tick() and so this condition was
pointless.
This commit is contained in:
Alexander Harkness
2018-01-16 19:13:17 +00:00
committed by GitHub
parent 3065a101a5
commit 07619d932d
5 changed files with 54 additions and 15 deletions

View File

@@ -46,6 +46,8 @@ void cExpOrb::SpawnOn(cClientHandle & a_Client)
void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
DetectCacti();
// Check player proximity no more than twice per second
if ((m_TicksAlive % 10) == 0)
{
@@ -79,3 +81,14 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Destroy(true);
}
}
bool cExpOrb::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (a_TDI.DamageType == dtCactusContact)
{
Destroy(true);
return true;
}
return super::DoTakeDamage(a_TDI);
}