starfall getclipdata

This commit is contained in:
Sevii 2024-12-22 15:38:43 +01:00
parent be435fc762
commit 435b4594be
2 changed files with 22 additions and 0 deletions

View File

@ -14,6 +14,7 @@ StarfallEx:
- ENTITY.clipExists
- ENTITY.getClipIndex
- ENTITY.physicsClipsLeft
- ENTITY.getClipData
Expression2:
- ENTITY.addClip

View File

@ -132,4 +132,25 @@ function ents_methods:physicsClipsLeft()
return ProperClipping.PhysicsClipsLeft(ent)
end
--- Returns the clip data
-- @return Table array of clip data (distance, normal, isInside, isPhysics), nil if it doesn't exist
function ents_methods:getClipData()
local ent = getent(self)
if ent.ClipData == nil then
return nil
end
local rtn = {}
for i, clip in ipairs(ent.ClipData) do
rtn[i] = {
distance = isnumber(clip.dist) and clip.dist or 0,
normal = vwrap(isvector(clip.norm) and clip.norm or Vector()),
isInside = isbool(clip.inside) and clip.inside or false,
isPhysics = isbool(clip.physics) and clip.physics or false,
}
end
return rtn
end
end