mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-08 09:36:42 +00:00
Add bindings for capacity and encumbrance
This commit is contained in:
parent
aa56e40bc3
commit
dddc1dc2bb
1 changed files with 11 additions and 4 deletions
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include <apps/openmw/mwworld/esmstore.hpp>
|
#include <apps/openmw/mwworld/esmstore.hpp>
|
||||||
|
|
||||||
|
//#include "../mwworld/class.hpp"
|
||||||
|
#include "apps/openmw/mwworld/class.hpp"
|
||||||
|
|
||||||
#include "../luabindings.hpp"
|
#include "../luabindings.hpp"
|
||||||
|
|
||||||
namespace MWLua
|
namespace MWLua
|
||||||
|
@ -17,10 +20,14 @@ namespace MWLua
|
||||||
[](const LObject& o) { containerPtr(o); return Inventory<LObject>{o}; },
|
[](const LObject& o) { containerPtr(o); return Inventory<LObject>{o}; },
|
||||||
[](const GObject& o) { containerPtr(o); return Inventory<GObject>{o}; }
|
[](const GObject& o) { containerPtr(o); return Inventory<GObject>{o}; }
|
||||||
);
|
);
|
||||||
//container["capacity"] = [](const Object& o) {
|
container["encumbrance"] = [](const Object& obj) -> float {
|
||||||
//const MWWorld::Class& cls = o.ptr().getClass();
|
const MWWorld::Ptr& ptr = containerPtr(obj);
|
||||||
//return cls.getCapacity(o);
|
return ptr.getClass().getEncumbrance(ptr);
|
||||||
//};
|
};
|
||||||
|
container["capacity"] = [](const Object& obj) -> float {
|
||||||
|
const MWWorld::Ptr& ptr = containerPtr(obj);
|
||||||
|
return ptr.getClass().getCapacity(ptr);
|
||||||
|
};
|
||||||
|
|
||||||
const MWWorld::Store<ESM::Container>* store = &MWBase::Environment::get().getWorld()->getStore().get<ESM::Container>();
|
const MWWorld::Store<ESM::Container>* store = &MWBase::Environment::get().getWorld()->getStore().get<ESM::Container>();
|
||||||
container["record"] = sol::overload(
|
container["record"] = sol::overload(
|
||||||
|
|
Loading…
Reference in a new issue