mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
Merge branch 'lua_crime_bounty' into 'master'
Lua: Add setCrimeLevel to types.Player See merge request OpenMW/openmw!4008
This commit is contained in:
commit
3942d7fb7e
2 changed files with 15 additions and 0 deletions
|
@ -186,6 +186,15 @@ namespace MWLua
|
||||||
const MWWorld::Class& cls = o.ptr().getClass();
|
const MWWorld::Class& cls = o.ptr().getClass();
|
||||||
return cls.getNpcStats(o.ptr()).getBounty();
|
return cls.getNpcStats(o.ptr()).getBounty();
|
||||||
};
|
};
|
||||||
|
player["setCrimeLevel"] = [](const Object& o, int amount) {
|
||||||
|
verifyPlayer(o);
|
||||||
|
if (!dynamic_cast<const GObject*>(&o))
|
||||||
|
throw std::runtime_error("Only global scripts can change crime level");
|
||||||
|
const MWWorld::Class& cls = o.ptr().getClass();
|
||||||
|
cls.getNpcStats(o.ptr()).setBounty(amount);
|
||||||
|
if (amount == 0)
|
||||||
|
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
|
||||||
|
};
|
||||||
player["isCharGenFinished"] = [](const Object&) -> bool {
|
player["isCharGenFinished"] = [](const Object&) -> bool {
|
||||||
return MWBase::Environment::get().getWorld()->getGlobalFloat(MWWorld::Globals::sCharGenState) == -1;
|
return MWBase::Environment::get().getWorld()->getGlobalFloat(MWWorld::Globals::sCharGenState) == -1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1123,6 +1123,12 @@
|
||||||
-- @param openmw.core#GameObject player
|
-- @param openmw.core#GameObject player
|
||||||
-- @return #number
|
-- @return #number
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Sets the bounty or crime level of the player, may only be used in global scripts
|
||||||
|
-- @function [parent=#Player] setCrimeLevel
|
||||||
|
-- @param openmw.core#GameObject player
|
||||||
|
-- @param #number crimeLevel The requested crime level
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Whether the character generation for this player is finished.
|
-- Whether the character generation for this player is finished.
|
||||||
-- @function [parent=#Player] isCharGenFinished
|
-- @function [parent=#Player] isCharGenFinished
|
||||||
|
|
Loading…
Reference in a new issue