1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Add bindings for capacity and encumbrance

This commit is contained in:
adam 2022-05-26 06:41:53 +00:00
parent aa56e40bc3
commit dddc1dc2bb

View File

@ -4,6 +4,9 @@
#include <apps/openmw/mwworld/esmstore.hpp>
//#include "../mwworld/class.hpp"
#include "apps/openmw/mwworld/class.hpp"
#include "../luabindings.hpp"
namespace MWLua
@ -17,10 +20,14 @@ namespace MWLua
[](const LObject& o) { containerPtr(o); return Inventory<LObject>{o}; },
[](const GObject& o) { containerPtr(o); return Inventory<GObject>{o}; }
);
//container["capacity"] = [](const Object& o) {
//const MWWorld::Class& cls = o.ptr().getClass();
//return cls.getCapacity(o);
//};
container["encumbrance"] = [](const Object& obj) -> float {
const MWWorld::Ptr& ptr = containerPtr(obj);
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>();
container["record"] = sol::overload(