mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
Merge branch 'lua-add-is-fleeing' into 'master'
lua - add isFleeing() to AI interface See merge request OpenMW/openmw!4256
This commit is contained in:
commit
488a05d14c
@ -132,6 +132,15 @@ namespace MWLua
|
|||||||
});
|
});
|
||||||
|
|
||||||
aiPackage["isRepeat"] = sol::readonly_property([](const AiPackage& p) { return p.getRepeat(); });
|
aiPackage["isRepeat"] = sol::readonly_property([](const AiPackage& p) { return p.getRepeat(); });
|
||||||
|
|
||||||
|
selfAPI["_isFleeing"] = [](SelfObject& self) -> bool {
|
||||||
|
const MWWorld::Ptr& ptr = self.ptr();
|
||||||
|
MWMechanics::AiSequence& ai = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||||
|
if (ai.isEmpty())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return ai.isFleeing();
|
||||||
|
};
|
||||||
selfAPI["_getActiveAiPackage"] = [](SelfObject& self) -> sol::optional<std::shared_ptr<AiPackage>> {
|
selfAPI["_getActiveAiPackage"] = [](SelfObject& self) -> sol::optional<std::shared_ptr<AiPackage>> {
|
||||||
const MWWorld::Ptr& ptr = self.ptr();
|
const MWWorld::Ptr& ptr = self.ptr();
|
||||||
MWMechanics::AiSequence& ai = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
MWMechanics::AiSequence& ai = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||||
|
@ -80,6 +80,11 @@ return {
|
|||||||
-- @return #Package
|
-- @return #Package
|
||||||
getActivePackage = function() return self:_getActiveAiPackage() end,
|
getActivePackage = function() return self:_getActiveAiPackage() end,
|
||||||
|
|
||||||
|
--- Return whether the actor is fleeing.
|
||||||
|
-- @function [parent=#AI] isFleeing
|
||||||
|
-- @return #boolean
|
||||||
|
isFleeing = function() return self:_isFleeing() end,
|
||||||
|
|
||||||
--- Start new AI package.
|
--- Start new AI package.
|
||||||
-- @function [parent=#AI] startPackage
|
-- @function [parent=#AI] startPackage
|
||||||
-- @param #table options See the "Built-in AI packages" page.
|
-- @param #table options See the "Built-in AI packages" page.
|
||||||
|
Loading…
Reference in New Issue
Block a user