Browse Source

Merge pull request #898 from EgzoT/EgzoT-setPathable

Add setPathable() function
Eduardo Bart 3 years ago
parent
commit
0a6e7dd74e
No account linked to committer's email address
3 changed files with 10 additions and 0 deletions
  1. 1
    0
      src/client/luafunctions.cpp
  2. 8
    0
      src/client/thingtype.cpp
  3. 1
    0
      src/client/thingtype.h

+ 1
- 0
src/client/luafunctions.cpp View File

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

+ 8
- 0
src/client/thingtype.cpp View File

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

+ 1
- 0
src/client/thingtype.h View File

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

Loading…
Cancel
Save