Skip to content

Commit

Permalink
Merge branch 'forurm' into 'master'
Browse files Browse the repository at this point in the history
Add types.Actor.isDead

See merge request OpenMW/openmw!3557
  • Loading branch information
jvoisin committed Nov 5, 2023
2 parents 9fe0e4c + 2d90176 commit 44dc29e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/openmw/mwlua/types/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ namespace MWLua
return dist <= actorsProcessingRange;
};

actor["isDead"] = [](const Object& o) {
const auto& target = o.ptr();
return target.getClass().getCreatureStats(target).isDead();
};

actor["getEncumbrance"] = [](const Object& actor) -> float {
const MWWorld::Ptr ptr = actor.ptr();
return ptr.getClass().getEncumbrance(ptr);
Expand Down
6 changes: 6 additions & 0 deletions files/lua_api/openmw/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
-- @param openmw.core#GameObject actor
-- @return #number

---
-- Check if the given actor is dead.
-- @function [parent=#Actor] isDead
-- @param openmw.core#GameObject actor
-- @return #boolean

---
-- Agent bounds to be used for pathfinding functions.
-- @function [parent=#Actor] getPathfindingAgentBounds
Expand Down

0 comments on commit 44dc29e

Please sign in to comment.