mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-09 03:57:51 +03:00
Merge branch 'add_getBounty_to_types_Player' into 'master'
Lua: Add getCrimeLevel() to types.Player See merge request OpenMW/openmw!3118
This commit is contained in:
commit
724d29aa63
5 changed files with 24 additions and 3 deletions
|
@ -62,7 +62,7 @@ add_openmw_dir (mwlua
|
|||
luamanagerimp object worldview userdataserializer luaevents engineevents objectvariant
|
||||
context globalscripts localscripts playerscripts luabindings objectbindings cellbindings
|
||||
camerabindings uibindings inputbindings nearbybindings postprocessingbindings stats debugbindings
|
||||
types/types types/door types/actor types/container types/weapon types/npc types/creature types/activator types/book types/lockpick types/probe types/apparatus types/potion types/ingredient types/misc types/repair types/armor types/light types/static types/clothing
|
||||
types/types types/door types/actor types/container types/weapon types/npc types/creature types/player types/activator types/book types/lockpick types/probe types/apparatus types/potion types/ingredient types/misc types/repair types/armor types/light types/static types/clothing
|
||||
worker magicbindings
|
||||
)
|
||||
|
||||
|
|
16
apps/openmw/mwlua/types/player.cpp
Normal file
16
apps/openmw/mwlua/types/player.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "types.hpp"
|
||||
|
||||
#include <apps/openmw/mwmechanics/npcstats.hpp>
|
||||
#include <apps/openmw/mwworld/class.hpp>
|
||||
|
||||
namespace MWLua
|
||||
{
|
||||
|
||||
void addPlayerBindings(sol::table player, const Context& context)
|
||||
{
|
||||
player["getCrimeLevel"] = [](const Object& o) -> int {
|
||||
const MWWorld::Class& cls = o.ptr().getClass();
|
||||
return cls.getNpcStats(o.ptr()).getBounty();
|
||||
};
|
||||
}
|
||||
}
|
|
@ -187,7 +187,7 @@ namespace MWLua
|
|||
addCreatureBindings(addType(ObjectTypeName::Creature, { ESM::REC_CREA }, ObjectTypeName::Actor), context);
|
||||
addNpcBindings(
|
||||
addType(ObjectTypeName::NPC, { ESM::REC_INTERNAL_PLAYER, ESM::REC_NPC_ }, ObjectTypeName::Actor), context);
|
||||
addType(ObjectTypeName::Player, { ESM::REC_INTERNAL_PLAYER }, ObjectTypeName::NPC);
|
||||
addPlayerBindings(addType(ObjectTypeName::Player, { ESM::REC_INTERNAL_PLAYER }, ObjectTypeName::NPC), context);
|
||||
|
||||
addArmorBindings(addType(ObjectTypeName::Armor, { ESM::REC_ARMO }, ObjectTypeName::Item), context);
|
||||
addClothingBindings(addType(ObjectTypeName::Clothing, { ESM::REC_CLOT }, ObjectTypeName::Item), context);
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace MWLua
|
|||
void addActorBindings(sol::table actor, const Context& context);
|
||||
void addWeaponBindings(sol::table weapon, const Context& context);
|
||||
void addNpcBindings(sol::table npc, const Context& context);
|
||||
void addPlayerBindings(sol::table player, const Context& context);
|
||||
void addCreatureBindings(sol::table creature, const Context& context);
|
||||
void addLockpickBindings(sol::table lockpick, const Context& context);
|
||||
void addProbeBindings(sol::table probe, const Context& context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue