mirror of
https://github.com/shadowscion/Prop2Mesh.git
synced 2025-03-04 03:13:03 -05:00
Merge pull request #52 from marchc1/controller-setpos-setang
Individual controller position & angle control
This commit is contained in:
commit
0460b6f7df
@ -479,6 +479,18 @@ end
|
||||
]]
|
||||
__e2setcost(10)
|
||||
|
||||
e2function void entity:p2mSetPos(number index, vector pos)
|
||||
if checkvalid(self, this, _POS, index) then
|
||||
this:SetControllerLinkPos(index, Vector(pos[1], pos[2], pos[3]))
|
||||
end
|
||||
end
|
||||
|
||||
e2function void entity:p2mSetAng(number index, angle ang)
|
||||
if checkvalid(self, this, _ANG, index) then
|
||||
this:SetControllerLinkAng(index, Angle(ang[1], ang[2], ang[3]))
|
||||
end
|
||||
end
|
||||
|
||||
e2function void entity:p2mSetAlpha(number index, number alpha)
|
||||
if checkvalid(self, this, _ALPHA, index) then
|
||||
this:SetControllerAlpha(index, alpha)
|
||||
|
@ -390,6 +390,36 @@ return function( instance )
|
||||
return cwrap( ent:GetControllerCol( index ) )
|
||||
end
|
||||
|
||||
--- Sets the position of the controller
|
||||
-- @param number index
|
||||
-- @param Vector position
|
||||
function ents_methods:p2mSetPos( index, pos )
|
||||
CheckType( self, ents_metatable )
|
||||
local ent = unwrap( self )
|
||||
|
||||
CheckLuaType( index, TYPE_NUMBER )
|
||||
if not checkValid( instance.player, ent, _POS, index, nil ) then
|
||||
return
|
||||
end
|
||||
|
||||
ent:SetControllerLinkPos( index, vunwrap( pos ) )
|
||||
end
|
||||
|
||||
--- Sets the angle of the controller
|
||||
-- @param number index
|
||||
-- @param Angle angle
|
||||
function ents_methods:p2mSetAng( index, ang )
|
||||
CheckType( self, ents_metatable )
|
||||
local ent = unwrap( self )
|
||||
|
||||
CheckLuaType( index, TYPE_NUMBER )
|
||||
if not checkValid( instance.player, ent, _ANG, index, nil ) then
|
||||
return
|
||||
end
|
||||
|
||||
ent:SetControllerLinkAng( index, aunwrap( ang ) )
|
||||
end
|
||||
|
||||
--- Sets the color of the controller
|
||||
-- @param number index
|
||||
-- @param Color color
|
||||
|
Loading…
Reference in New Issue
Block a user