Skip to content

Commit

Permalink
Merge branch 'capacity' into 'master'
Browse files Browse the repository at this point in the history
Lua: Expose capacity for creatures as well

See merge request OpenMW/openmw!4481
  • Loading branch information
Assumeru committed Dec 16, 2024
2 parents e4cced0 + 81f2402 commit 03f1702
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 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 @@ -415,6 +415,11 @@ namespace MWLua
return ptr.getClass().getEncumbrance(ptr);
};

actor["getCapacity"] = [](const Object& actor) -> float {
const MWWorld::Ptr ptr = actor.ptr();
return ptr.getClass().getCapacity(ptr);
};

addActorStatsBindings(actor, context);
addActorMagicBindings(actor, context);
}
Expand Down
4 changes: 0 additions & 4 deletions apps/openmw/mwlua/types/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,5 @@ namespace MWLua

return res;
};
npc["getCapacity"] = [](const Object& actor) -> float {
const MWWorld::Ptr ptr = actor.ptr();
return ptr.getClass().getCapacity(ptr);
};
}
}
12 changes: 6 additions & 6 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

---
-- Get the total weight that the actor can carry.
-- @function [parent=#Actor] getCapacity
-- @param openmw.core#GameObject actor
-- @return #number

---
-- Check if the given actor is dead (health reached 0, so death process started).
-- @function [parent=#Actor] isDead
Expand Down Expand Up @@ -1035,12 +1041,6 @@
-- @param openmw.core#GameObject player The player that you want to modify the disposition for.
-- @param #number value Base disposition modification value

---
-- Get the total weight that the actor can carry.
-- @function [parent=#NPC] getCapacity
-- @param openmw.core#GameObject actor
-- @return #number

--- @{#Classes}: Class Data
-- @field [parent=#NPC] #Classes classes

Expand Down

0 comments on commit 03f1702

Please sign in to comment.