Skip to content

Commit

Permalink
Add more 'pose' related functions (#1567)
Browse files Browse the repository at this point in the history
* Add more pose related functions

* Rename 'id' to 'pose' in 'getPoseRange' docs

* Make 'getPoseRange' only accept number parameter

* Rename 'pose' to 'id' and small doc fix
  • Loading branch information
adamnejm authored Dec 3, 2023
1 parent 167012b commit c0416e8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lua/starfall/libs_sh/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,34 @@ function ents_methods:getPose(pose)
return getent(self):GetPoseParameter(pose)
end

--- Returns the amount of pose parameters the entity has
-- @return number Amount of poses
function ents_methods:getPoseCount()
return getent(self):GetNumPoseParameters()
end

--- Returns pose index corresponding to the given name
-- @param string pose Pose name
-- @return number Pose index or -1 if not found
function ents_methods:getPoseIndex(pose)
return getent(self):LookupPoseParameter(pose)
end

--- Returns pose name corresponding to the given index
-- @param number id Pose index (starting from 0)
-- @return string Pose name or empty string if not found
function ents_methods:getPoseName(id)
return getent(self):GetPoseParameterName(id)
end

--- Returns pose value range
-- @param number id Pose index (starting from 0)
-- @return number? Minimum pose value or nil if pose not found
-- @return number? Maximum pose value or nil if pose not found
function ents_methods:getPoseRange(id)
return getent(self):GetPoseParameterRange(id)
end

--- Returns a table of flexname -> flexid pairs for use in flex functions.
-- @return table Table of flexes
function ents_methods:getFlexes()
Expand Down

0 comments on commit c0416e8

Please sign in to comment.