1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 01:10:10 +00:00

Add a Lua function to check if actor's death is finished

This commit is contained in:
Andrei Kortunov 2024-02-22 19:06:15 +04:00
parent 35f547ad7c
commit 7c4b42ab2a
3 changed files with 13 additions and 2 deletions

View File

@ -80,7 +80,7 @@ message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 49) set(OPENMW_VERSION_MINOR 49)
set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_LUA_API_REVISION 54) set(OPENMW_LUA_API_REVISION 55)
set(OPENMW_POSTPROCESSING_API_REVISION 1) set(OPENMW_POSTPROCESSING_API_REVISION 1)
set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_COMMITHASH "")

View File

@ -403,6 +403,11 @@ namespace MWLua
return target.getClass().getCreatureStats(target).isDead(); return target.getClass().getCreatureStats(target).isDead();
}; };
actor["isDeathFinished"] = [](const Object& o) {
const auto& target = o.ptr();
return target.getClass().getCreatureStats(target).isDeathAnimationFinished();
};
actor["getEncumbrance"] = [](const Object& actor) -> float { actor["getEncumbrance"] = [](const Object& actor) -> float {
const MWWorld::Ptr ptr = actor.ptr(); const MWWorld::Ptr ptr = actor.ptr();
return ptr.getClass().getEncumbrance(ptr); return ptr.getClass().getEncumbrance(ptr);

View File

@ -16,11 +16,17 @@
-- @return #number -- @return #number
--- ---
-- Check if the given actor is dead. -- Check if the given actor is dead (health reached 0, so death process started).
-- @function [parent=#Actor] isDead -- @function [parent=#Actor] isDead
-- @param openmw.core#GameObject actor -- @param openmw.core#GameObject actor
-- @return #boolean -- @return #boolean
---
-- Check if the given actor's death process is finished.
-- @function [parent=#Actor] isDeathFinished
-- @param openmw.core#GameObject actor
-- @return #boolean
--- ---
-- Agent bounds to be used for pathfinding functions. -- Agent bounds to be used for pathfinding functions.
-- @function [parent=#Actor] getPathfindingAgentBounds -- @function [parent=#Actor] getPathfindingAgentBounds