From 90be4e7efdb455dc4bf4e150c403586a5c73d3f1 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sat, 3 Sep 2016 14:31:27 +0300 Subject: Entities now bail out of ticks if destroyed (#3363) --- src/Mobs/Pig.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Mobs/Pig.cpp') diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index b67b29d87..6b420b235 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -85,6 +85,11 @@ void cPig::OnRightClicked(cPlayer & a_Player) void cPig::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); + if (!IsTicking()) + { + // The base class tick destroyed us + return; + } // If the attachee player is holding a carrot-on-stick, let them drive this pig: if (m_bIsSaddled && (m_Attachee != nullptr)) -- cgit v1.2.3