From c51df93e3e483b83f098ea86636cb73bb7f82c14 Mon Sep 17 00:00:00 2001 From: EgzoT Date: Wed, 15 Nov 2017 01:02:06 +0100 Subject: [PATCH] Add setPathable() function Adding function who changing item attribute (ThingAttrNotPathable). Allows to walk on not pathable items (ThingAttrNotPathable -> true) like parcels, fire fields etc. and vice versa. Modifying item attribute without editing items sources files. Temporary action for the duration of the client session. Usage: print(g_things.getThingType(3504):isNotPathable()) -> true g_things.getThingType(3504):setPathable(true) print(g_things.getThingType(3504):isNotPathable()) -> false Helpful for highter levels players to ignoring "avoiding" fire/energy/poison fields etc. when using map click. --- src/client/luafunctions.cpp | 1 + src/client/thingtype.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index 1c1ce018..66d0ee84 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -526,6 +526,7 @@ void Client::registerLuaFunctions() g_lua.bindClassMemberFunction("isNotMoveable", &ThingType::isNotMoveable); g_lua.bindClassMemberFunction("blockProjectile", &ThingType::blockProjectile); g_lua.bindClassMemberFunction("isNotPathable", &ThingType::isNotPathable); + g_lua.bindClassMemberFunction("setPathable", &ThingType::setPathable); g_lua.bindClassMemberFunction("isPickupable", &ThingType::isPickupable); g_lua.bindClassMemberFunction("isHangable", &ThingType::isHangable); g_lua.bindClassMemberFunction("isHookSouth", &ThingType::isHookSouth); diff --git a/src/client/thingtype.h b/src/client/thingtype.h index 278df324..b8709574 100644 --- a/src/client/thingtype.h +++ b/src/client/thingtype.h @@ -178,6 +178,7 @@ public: bool isNotMoveable() { return m_attribs.has(ThingAttrNotMoveable); } bool blockProjectile() { return m_attribs.has(ThingAttrBlockProjectile); } bool isNotPathable() { return m_attribs.has(ThingAttrNotPathable); } + void setPathable(bool var) { var == true ? m_attribs.remove(ThingAttrNotPathable) : m_attribs.set(ThingAttrNotPathable, true); } bool isPickupable() { return m_attribs.has(ThingAttrPickupable); } bool isHangable() { return m_attribs.has(ThingAttrHangable); } bool isHookSouth() { return m_attribs.has(ThingAttrHookSouth); }