Garry's Mod Wiki

Revision Difference

constraint.CanConstrain#546968

<function name="CanConstrain" parent="constraint" type="libraryfunc"> <description>Basic checks to make sure that the specified entity and bone are valid. Returns false if we should not be constraining the entity.</description> <realm>Server</realm> <file line="278">lua/includes/modules/constraint.lua</file> <file line="244-L257">lua/includes/modules/constraint.lua</file> <args> <arg name="ent" type="Entity">The entity to check</arg> <arg name="bone" type="number">The bone of the entity to check (use 0 for mono boned ents)</arg> </args> <rets> <ret name="" type="boolean">shouldConstrain</ret> </rets> </function> <example> <description>From modules/constraint.lua</description> <code> function Weld( Ent1, Ent2, Bone1, Bone2, forcelimit, nocollide, deleteonbreak ) if ( !CanConstrain( Ent1, Bone1 ) ) then return false end if ( !CanConstrain( Ent2, Bone2 ) ) then return false end </code> </example>