From 07619d932d703611c2e3e1296871bee5e27876b7 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Tue, 16 Jan 2018 19:13:17 +0000 Subject: 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. --- src/Entities/ExpOrb.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Entities/ExpOrb.cpp') diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 4ae847bf8..dd16a4762 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -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); +} -- cgit v1.2.3