mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Merge branch 'lua_force_run_sneak' into 'master'
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Lua: Add set/get ForceRun to AI Interface See merge request OpenMW/openmw!3576
This commit is contained in:
commit
9e1b557ac9
2 changed files with 22 additions and 0 deletions
|
@ -143,6 +143,14 @@ namespace MWLua
|
|||
else
|
||||
return ai.isFleeing();
|
||||
};
|
||||
selfAPI["_setForceRun"] = [](SelfObject& self, bool state) {
|
||||
const MWWorld::Ptr& ptr = self.ptr();
|
||||
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_ForceRun, state);
|
||||
};
|
||||
selfAPI["_getForceRun"] = [](SelfObject& self) {
|
||||
const MWWorld::Ptr& ptr = self.ptr();
|
||||
return ptr.getClass().getCreatureStats(ptr).getMovementFlag(MWMechanics::CreatureStats::Flag_ForceRun);
|
||||
};
|
||||
selfAPI["_getActiveAiPackage"] = [](SelfObject& self) -> sol::optional<std::shared_ptr<AiPackage>> {
|
||||
const MWWorld::Ptr& ptr = self.ptr();
|
||||
MWMechanics::AiSequence& ai = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||
|
|
|
@ -114,6 +114,20 @@ return {
|
|||
filterPackages(function(p) return packageType and p.type ~= packageType end)
|
||||
end,
|
||||
|
||||
--- Forces the current actor to only run when moving.
|
||||
-- @function [parent=#AI] setForceRun
|
||||
-- @param #boolean state
|
||||
setForceRun = function(state)
|
||||
self:_setForceRun(state)
|
||||
end,
|
||||
|
||||
--- Checks if the current actor is forced to only run when moving.
|
||||
-- @function [parent=#AI] getForceRun
|
||||
-- @return #boolean True if forced to run, false if not.
|
||||
getForceRun = function()
|
||||
return self:_getForceRun()
|
||||
end,
|
||||
|
||||
--- Return the target of the active package if the package has given type
|
||||
-- @function [parent=#AI] getActiveTarget
|
||||
-- @param #string packageType The expected type of the active package
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue