Revision Difference
constraint.Weld#524849
<function name="Weld" parent="constraint" type="libraryfunc">
<description>Creates a weld constraint</description>
<realm>Server</realm>
<file line="419">lua/includes/modules/constraint.lua</file>
<args>
<arg name="ent1" type="Entity">The first entity</arg>
<arg name="ent2" type="Entity">The second entity</arg>
<arg name="bone1" type="number">The bonenumber of the first entity (0 for monoboned entities) &lt;br&gt;
&lt;br&gt;⤶
PhysObj number for ragdolls, see: <page>Entity:TranslateBoneToPhysBone</page>.</arg>⤶
<arg name="bone1" type="number">The bonenumber of the first entity (0 for monoboned entities)
⤶
PhysObj number for ragdolls, see: <page>Entity:TranslateBoneToPhysBone</page>.</arg>⤶
<arg name="bone2" type="number">The bonenumber of the second entity</arg>
<arg name="forcelimit" type="number">The amount of force appliable to the constraint before it will break (0 is never)</arg>
<arg name="nocollide" type="boolean">Should ent1 be nocollided to ent2 via this constraint</arg>
<arg name="deleteent1onbreak" type="boolean">If true, when ent2 is removed, ent1 will also be removed</arg>
</args>
<rets>
<ret name="" type="Entity">constraint</ret>
</rets>
</function>
<example>
<description>Adapted from stools/thruster.lua</description>
<code>
function TOOL:LeftClick( trace )
/* Boilerplate stool code to extract ClientConVars to variables */
local thruster = MakeThruster( ply, model, Ang, trace.HitPos, key, key_bk, force, toggle, effect, damageable, soundname )
local weld = constraint.Weld( thruster, trace.Entity, 0, trace.PhysicsBone, 0, collision == 0, true )
-- If you remove the entity thrusters are welded to, the thruster is removed as well
end
</code>
</example>