Merge branch 'lua-add-is-fleeing' into 'master'

lua - add isFleeing() to AI interface

See merge request OpenMW/openmw!4256
pull/3236/head
psi29a 5 months ago
commit 488a05d14c

@ -132,6 +132,15 @@ namespace MWLua
});
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>> {
const MWWorld::Ptr& ptr = self.ptr();
MWMechanics::AiSequence& ai = ptr.getClass().getCreatureStats(ptr).getAiSequence();

@ -80,6 +80,11 @@ return {
-- @return #Package
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.
-- @function [parent=#AI] startPackage
-- @param #table options See the "Built-in AI packages" page.

Loading…
Cancel
Save