1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

add isRestocking

This commit is contained in:
Zackhasacat 2023-08-28 08:30:54 -05:00
parent 84987450ee
commit 5fdaee093a
4 changed files with 9 additions and 3 deletions

View File

@ -214,8 +214,6 @@ namespace MWLua
const ObjectT& o) mutable { return types[getLiveCellRefType(o.ptr().mRef)]; });
objectT["count"] = sol::readonly_property([](const ObjectT& o) { return o.ptr().getRefData().getCount(); });
objectT["baseCount"]
= sol::readonly_property([](const ObjectT& o) { return o.ptr().getRefData().getCount(false); });
objectT[sol::meta_function::equal_to] = [](const ObjectT& a, const ObjectT& b) { return a.id() == b.id(); };
objectT[sol::meta_function::to_string] = &ObjectT::toString;
objectT["sendEvent"] = [context](const ObjectT& dest, std::string eventName, const sol::object& eventData) {

View File

@ -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 GObject& object) -> bool { return object.ptr().getRefData().getCount(false) < 0; };
}
}

View File

@ -161,7 +161,6 @@
-- @field #Cell cell The cell where the object currently is. During loading a game and for objects in an inventory or a container `cell` is nil.
-- @field #any type Type of the object (one of the tables from the package @{openmw.types#types}).
-- @field #number count Count (>1 means a stack of objects).
-- @field #number baseCount Base Count (<1 means a restocking item).
-- @field #string recordId Returns record ID of the object in lowercase.
---

View File

@ -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