diff --git a/CHANGELOG.md b/CHANGELOG.md index 10b3da0305..1e2992c3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -254,6 +254,7 @@ Feature #8034: (Lua) Containers should have respawning/organic flags Feature #8067: Support Game Mode on macOS Feature #8078: OpenMW-CS Terrain Equalize Tool + Feature #8087: Creature movement flags are not exposed Task #5896: Do not use deprecated MyGUI properties Task #6085: Replace boost::filesystem with std::filesystem Task #6149: Dehardcode Lua API_REVISION diff --git a/apps/openmw/mwlua/types/creature.cpp b/apps/openmw/mwlua/types/creature.cpp index 61ddc3f4fa..39bfe1198f 100644 --- a/apps/openmw/mwlua/types/creature.cpp +++ b/apps/openmw/mwlua/types/creature.cpp @@ -58,6 +58,16 @@ namespace MWLua res[index++] = attack; return LuaUtil::makeReadOnly(res); }); + record["canFly"] = sol::readonly_property( + [](const ESM::Creature& rec) -> bool { return rec.mFlags & ESM::Creature::Flies; }); + record["canSwim"] = sol::readonly_property( + [](const ESM::Creature& rec) -> bool { return rec.mFlags & ESM::Creature::Swims; }); + record["canUseWeapons"] = sol::readonly_property( + [](const ESM::Creature& rec) -> bool { return rec.mFlags & ESM::Creature::Weapon; }); + record["canWalk"] = sol::readonly_property( + [](const ESM::Creature& rec) -> bool { return rec.mFlags & ESM::Creature::Walks; }); + record["isBiped"] = sol::readonly_property( + [](const ESM::Creature& rec) -> bool { return rec.mFlags & ESM::Creature::Bipedal; }); addActorServicesBindings(record, context); } diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index b0c8f04019..412b1be442 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -847,6 +847,11 @@ -- @field #list<#number> attack A table of the 3 randomly selected attacks used by creatures that do not carry weapons. The table consists of 6 numbers split into groups of 2 values corresponding to minimum and maximum damage in that order. -- @field #map<#string, #boolean> servicesOffered The services of the creature, in a table. Value is if the service is provided or not, and they are indexed by: Spells, Spellmaking, Enchanting, Training, Repair, Barter, Weapon, Armor, Clothing, Books, Ingredients, Picks, Probes, Lights, Apparatus, RepairItems, Misc, Potions, MagicItems, Travel. -- @field #list<#TravelDestination> travelDestinations A list of @{#TravelDestination}s for this creature. +-- @field #boolean canFly whether the creature can fly +-- @field #boolean canSwim whether the creature can swim +-- @field #boolean canWalk whether the creature can walk +-- @field #boolean canUseWeapons whether the creature can use weapons and shields +-- @field #boolean isBiped whether the creature is a biped --- @{#NPC} functions