From a64ebc7e7b93f3b633c51e4b2e4adaa26fa4a88e Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 2 Aug 2012 10:39:08 -0300 Subject: [PATCH] Stop walk animation after changing floors --- src/otclient/creature.cpp | 2 ++ src/otclient/tile.cpp | 9 +++++++++ src/otclient/tile.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/otclient/creature.cpp b/src/otclient/creature.cpp index 48bcccec..56cd21fb 100644 --- a/src/otclient/creature.cpp +++ b/src/otclient/creature.cpp @@ -296,6 +296,7 @@ void Creature::onAppear() // creature appeared the first time or wasn't seen for a long time if(m_removed) { + stopWalk(); m_removed = false; callLuaField("onAppear"); // walk @@ -304,6 +305,7 @@ void Creature::onAppear() callLuaField("onWalk", m_oldPosition, m_position); // teleport } else if(m_oldPosition != m_position) { + stopWalk(); callLuaField("onDisappear"); callLuaField("onAppear"); } // else turn diff --git a/src/otclient/tile.cpp b/src/otclient/tile.cpp index c7e4ecc7..bf78578b 100644 --- a/src/otclient/tile.cpp +++ b/src/otclient/tile.cpp @@ -423,6 +423,15 @@ bool Tile::isWalkable() return true; } +bool Tile::changesFloor() +{ + for(const ThingPtr& thing : m_things) { + if(thing->isTranslucent() || (thing->isOnBottom() && thing->hasElevation())) + return true; + } + return false; +} + bool Tile::isPathable() { if(!isWalkable()) diff --git a/src/otclient/tile.h b/src/otclient/tile.h index fd84f0e9..c2246932 100644 --- a/src/otclient/tile.h +++ b/src/otclient/tile.h @@ -92,6 +92,7 @@ public: int getThingCount() { return m_things.size() + m_effects.size(); } bool isPathable(); bool isWalkable(); + bool changesFloor(); bool isFullGround(); bool isFullyOpaque(); bool isLookPossible();