mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 12:41:01 +00:00
[Lua] Add alias types.Container.inventory = types.Container.content
This commit is contained in:
parent
84e71f4977
commit
ac9facabf5
@ -28,15 +28,9 @@ namespace MWLua
|
|||||||
|
|
||||||
void addContainerBindings(sol::table container, const Context& context)
|
void addContainerBindings(sol::table container, const Context& context)
|
||||||
{
|
{
|
||||||
container["content"] = sol::overload(
|
container["content"] = sol::overload([](const LObject& o) { return Inventory<LObject>{ o }; },
|
||||||
[](const LObject& o) {
|
[](const GObject& o) { return Inventory<GObject>{ o }; });
|
||||||
containerPtr(o);
|
container["inventory"] = container["content"];
|
||||||
return Inventory<LObject>{ o };
|
|
||||||
},
|
|
||||||
[](const GObject& o) {
|
|
||||||
containerPtr(o);
|
|
||||||
return Inventory<GObject>{ o };
|
|
||||||
});
|
|
||||||
container["encumbrance"] = [](const Object& obj) -> float {
|
container["encumbrance"] = [](const Object& obj) -> float {
|
||||||
const MWWorld::Ptr& ptr = containerPtr(obj);
|
const MWWorld::Ptr& ptr = containerPtr(obj);
|
||||||
return ptr.getClass().getEncumbrance(ptr);
|
return ptr.getClass().getEncumbrance(ptr);
|
||||||
|
@ -1440,7 +1440,9 @@
|
|||||||
-- @param #ActivatorRecord activator A Lua table with the fields of a ActivatorRecord.
|
-- @param #ActivatorRecord activator A Lua table with the fields of a ActivatorRecord.
|
||||||
-- @return #ActivatorRecord A strongly typed Activator record.
|
-- @return #ActivatorRecord A strongly typed Activator record.
|
||||||
|
|
||||||
--- @{#Container} functions
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- @{#Container} functions
|
||||||
-- @field [parent=#types] #Container Container
|
-- @field [parent=#types] #Container Container
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1455,6 +1457,12 @@
|
|||||||
-- @param openmw.core#GameObject object
|
-- @param openmw.core#GameObject object
|
||||||
-- @return openmw.core#Inventory
|
-- @return openmw.core#Inventory
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Container content (same as `Container.content`, added for consistency with `Actor.inventory`).
|
||||||
|
-- @function [parent=#Container] inventory
|
||||||
|
-- @param openmw.core#GameObject object
|
||||||
|
-- @return openmw.core#Inventory
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Whether the object is a Container.
|
-- Whether the object is a Container.
|
||||||
-- @function [parent=#Container] objectIsInstance
|
-- @function [parent=#Container] objectIsInstance
|
||||||
@ -1487,7 +1495,9 @@
|
|||||||
-- @field #string mwscript MWScript on this container (can be empty)
|
-- @field #string mwscript MWScript on this container (can be empty)
|
||||||
-- @field #number weight capacity of this container
|
-- @field #number weight capacity of this container
|
||||||
|
|
||||||
--- @{#Door} functions
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- @{#Door} functions
|
||||||
-- @field [parent=#types] #Door Door
|
-- @field [parent=#types] #Door Door
|
||||||
|
|
||||||
---
|
---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user