Merge pull request #898 from EgzoT/EgzoT-setPathable

Add setPathable() function
This commit is contained in:
Eduardo Bart 2017-11-16 23:51:15 -02:00 committed by GitHub
commit 0a6e7dd74e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -526,6 +526,7 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<ThingType>("isNotMoveable", &ThingType::isNotMoveable); g_lua.bindClassMemberFunction<ThingType>("isNotMoveable", &ThingType::isNotMoveable);
g_lua.bindClassMemberFunction<ThingType>("blockProjectile", &ThingType::blockProjectile); g_lua.bindClassMemberFunction<ThingType>("blockProjectile", &ThingType::blockProjectile);
g_lua.bindClassMemberFunction<ThingType>("isNotPathable", &ThingType::isNotPathable); g_lua.bindClassMemberFunction<ThingType>("isNotPathable", &ThingType::isNotPathable);
g_lua.bindClassMemberFunction<ThingType>("setPathable", &ThingType::setPathable);
g_lua.bindClassMemberFunction<ThingType>("isPickupable", &ThingType::isPickupable); g_lua.bindClassMemberFunction<ThingType>("isPickupable", &ThingType::isPickupable);
g_lua.bindClassMemberFunction<ThingType>("isHangable", &ThingType::isHangable); g_lua.bindClassMemberFunction<ThingType>("isHangable", &ThingType::isHangable);
g_lua.bindClassMemberFunction<ThingType>("isHookSouth", &ThingType::isHookSouth); g_lua.bindClassMemberFunction<ThingType>("isHookSouth", &ThingType::isHookSouth);

View File

@ -564,3 +564,11 @@ int ThingType::getExactSize(int layer, int xPattern, int yPattern, int zPattern,
Size size = m_texturesFramesOriginRects[animationPhase][frameIndex].size() - m_texturesFramesOffsets[animationPhase][frameIndex].toSize(); Size size = m_texturesFramesOriginRects[animationPhase][frameIndex].size() - m_texturesFramesOffsets[animationPhase][frameIndex].toSize();
return std::max<int>(size.width(), size.height()); return std::max<int>(size.width(), size.height());
} }
void ThingType::setPathable(bool var)
{
if(var == true)
m_attribs.remove(ThingAttrNotPathable);
else
m_attribs.set(ThingAttrNotPathable, true);
}

View File

@ -206,6 +206,7 @@ public:
// additional // additional
float getOpacity() { return m_opacity; } float getOpacity() { return m_opacity; }
bool isNotPreWalkable() { return m_attribs.has(ThingAttrNotPreWalkable); } bool isNotPreWalkable() { return m_attribs.has(ThingAttrNotPreWalkable); }
void setPathable(bool var);
private: private:
const TexturePtr& getTexture(int animationPhase); const TexturePtr& getTexture(int animationPhase);