mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 12:39:55 +00:00
Add getCrimeLevel() to types.Player
This commit is contained in:
parent
75c371de66
commit
8962cb818c
@ -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);
|
||||
|
@ -647,7 +647,11 @@
|
||||
-- @param openmw.core#GameObject object
|
||||
-- @return #boolean
|
||||
|
||||
|
||||
---
|
||||
-- Returns the bounty or crime level of the player
|
||||
-- @function [parent=#Player] getCrimeLevel
|
||||
-- @param openmw.core#GameObject actor
|
||||
-- @return #number
|
||||
|
||||
--- @{#Armor} functions
|
||||
-- @field [parent=#types] #Armor Armor
|
||||
|
Loading…
x
Reference in New Issue
Block a user