From 7c4b42ab2a7cee4eec39fabf7ba8a95c2c735da0 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Thu, 22 Feb 2024 19:06:15 +0400 Subject: [PATCH] Add a Lua function to check if actor's death is finished --- CMakeLists.txt | 2 +- apps/openmw/mwlua/types/actor.cpp | 5 +++++ files/lua_api/openmw/types.lua | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f13def9ab0..107a8691ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MINOR 49) 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_VERSION_COMMITHASH "") diff --git a/apps/openmw/mwlua/types/actor.cpp b/apps/openmw/mwlua/types/actor.cpp index 4fda04e7c5..3b0142e441 100644 --- a/apps/openmw/mwlua/types/actor.cpp +++ b/apps/openmw/mwlua/types/actor.cpp @@ -403,6 +403,11 @@ namespace MWLua 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 { const MWWorld::Ptr ptr = actor.ptr(); return ptr.getClass().getEncumbrance(ptr); diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index a7f57d3a6c..0c51544f64 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -16,11 +16,17 @@ -- @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 -- @param openmw.core#GameObject actor -- @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. -- @function [parent=#Actor] getPathfindingAgentBounds