Stop walk animation after changing floors

This commit is contained in:
Eduardo Bart 2012-08-02 10:39:08 -03:00
parent b9dfc7784c
commit a64ebc7e7b
3 changed files with 12 additions and 0 deletions

View File

@ -296,6 +296,7 @@ void Creature::onAppear()
// creature appeared the first time or wasn't seen for a long time // creature appeared the first time or wasn't seen for a long time
if(m_removed) { if(m_removed) {
stopWalk();
m_removed = false; m_removed = false;
callLuaField("onAppear"); callLuaField("onAppear");
// walk // walk
@ -304,6 +305,7 @@ void Creature::onAppear()
callLuaField("onWalk", m_oldPosition, m_position); callLuaField("onWalk", m_oldPosition, m_position);
// teleport // teleport
} else if(m_oldPosition != m_position) { } else if(m_oldPosition != m_position) {
stopWalk();
callLuaField("onDisappear"); callLuaField("onDisappear");
callLuaField("onAppear"); callLuaField("onAppear");
} // else turn } // else turn

View File

@ -423,6 +423,15 @@ bool Tile::isWalkable()
return true; 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() bool Tile::isPathable()
{ {
if(!isWalkable()) if(!isWalkable())

View File

@ -92,6 +92,7 @@ public:
int getThingCount() { return m_things.size() + m_effects.size(); } int getThingCount() { return m_things.size() + m_effects.size(); }
bool isPathable(); bool isPathable();
bool isWalkable(); bool isWalkable();
bool changesFloor();
bool isFullGround(); bool isFullGround();
bool isFullyOpaque(); bool isFullyOpaque();
bool isLookPossible(); bool isLookPossible();