Revision Difference
constraint.Hydraulic#560652
<function name="Hydraulic" parent="constraint" type="libraryfunc">
<description>Creates a controllable <page>constraint.Elastic</page>, aka a Hydraulic constraint.</description>
<realm>Server</realm>
<file line="1337-L1415">lua/includes/modules/constraint.lua</file>
<args>
<arg name="player" type="Player">The player that will be used to call <page>numpad.OnDown</page>.</arg>
<arg name="player" type="Player">The player that will be able to control the constraint. Used to call <page>numpad.OnDown</page>.</arg>
<arg name="ent1" type="Entity">First entity.</arg>
<arg name="ent2" type="Entity">Second entity.</arg>
<arg name="bone1" type="number">Physics Object number of first entity to constrain to. (0 for non-ragdolls).</arg>⤶
<arg name="bone2" type="number">Physics Object number of first second to constrain to. (0 for non-ragdolls). Must be different from `bone1`.</arg>
<arg name="bone1" type="number"><page>PhysObj</page> number of first entity to constrain to. (0 for non-ragdolls).⤶
⤶
See <page>Entity:TranslateBoneToPhysBone</page>.</arg>
<arg name="bone2" type="number"><page>PhysObj</page> number of second entity to constrain to. (0 for non-ragdolls). Must be different from `bone1`.⤶
⤶
See <page>Entity:TranslateBoneToPhysBone</page>.</arg>⤶
<arg name="localPos1" type="Vector">Position relative to the the first physics object to constrain to.</arg>
<arg name="localPos2" type="Vector">Position relative to the the second physics object to constrain to.</arg>
<arg name="length1" type="number">Minimum length of the constraint.</arg>
<arg name="length2" type="number">Maximum length of the constraint.</arg>
<arg name="width" type="number">The width of the rope.</arg>
<arg name="key" type="number">The key binding, corresponding to an <page>Enums/KEY</page></arg>
<arg name="slider" type="number">Whether the hydraulic is fixed, i.e. cannot bend. Must be `1` to act as `true`.</arg>
<arg name="speed" type="number">How fast it changes the length from `length1` to `length2` and backwards.</arg>
<arg name="material" type="string" default="">The material of the rope. If unset, will be solid black.</arg>
<arg name="color" type="table" default="color_white">The color of the rope. See <page>Global.Color</page>.</arg>
</args>
<rets>
<ret name="" type="Entity">The created constraint. (`phys_spring`) Will return `false` if the constraint could not be created.</ret>
<ret name="" type="Entity">The crated rope. (`keyframe_rope`) Will return `nil` if the constraint could not be created.</ret>
<ret name="" type="Entity">The created constraint. ([phys_spring](https://developer.valvesoftware.com/wiki/Phys_spring)) Will return `false` if the constraint could not be created.</ret>
<ret name="" type="Entity">The crated rope. ([keyframe_rope](https://developer.valvesoftware.com/wiki/Keyframe_rope)) Will return `nil` if the constraint could not be created.</ret>
<ret name="" type="Entity">The muscle controller. (`gmod_winch_controller`) Will return `nil` if the constraint could not be created.</ret>
<ret name="" type="Entity">The slider if `fixed` was exactly `1`. Will return nil otherwise, or if the constraint could not be created.</ret>
<ret name="" type="Entity">The slider ([phys_slideconstraint](https://developer.valvesoftware.com/wiki/Phys_slideconstraint)) if `fixed` was exactly `1`. Will return nil otherwise, or if the constraint could not be created.</ret>
</rets>
</function>