diff --git a/apps/openmw/mwlua/types/item.cpp b/apps/openmw/mwlua/types/item.cpp index 2b77b6a7c8..e15be1a2e4 100644 --- a/apps/openmw/mwlua/types/item.cpp +++ b/apps/openmw/mwlua/types/item.cpp @@ -12,5 +12,7 @@ namespace MWLua = [](const Object& object) { return object.ptr().getCellRef().getEnchantmentCharge(); }; item["setEnchantmentCharge"] = [](const GObject& object, float charge) { object.ptr().getCellRef().setEnchantmentCharge(charge); }; + item["isRestocking"] + = [](const Object& object) -> bool { return object.ptr().getRefData().getCount(false) < 0; }; } } diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 0c4a87563b..cc8a0365f1 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -632,6 +632,13 @@ -- @param openmw.core#GameObject item -- @return #number The charge remaining. -1 if the enchantment has never been used, implying the charge is full. Unenchanted items will always return a value of -1. +--- +-- Checks if the item restocks. +-- Returns true if the object restocks, and false otherwise. +-- @function [parent=#Item] isRestocking +-- @param openmw.core#GameObject item +-- @return #boolean + --- -- Set this item's enchantment charge. -- @function [parent=#Item] setEnchantmentCharge