diff --git a/lua/entities/gmod_wire_expression2/core/custom/constraintcore.lua b/lua/entities/gmod_wire_expression2/core/custom/constraintcore.lua index bd54a56246..66facd4eeb 100644 --- a/lua/entities/gmod_wire_expression2/core/custom/constraintcore.lua +++ b/lua/entities/gmod_wire_expression2/core/custom/constraintcore.lua @@ -268,8 +268,6 @@ local function createHydraulic(self, index, ent1, ent2, v1, v2, width, bone1, bo if not checkCount( self, true ) then return end local constraints = setupEntConstraints( ent1 ) - width = math.Clamp(width, 0, 50) - local existing = constraints[index] if IsValid( existing ) then existing:Remove() end @@ -280,7 +278,7 @@ local function createHydraulic(self, index, ent1, ent2, v1, v2, width, bone1, bo constant, damping = CalcElasticConsts( getBone(ent1,bone1), getBone(ent2,bone2), ent1, ent2 ) end - local cons, rope = constraint.Elastic( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, constant, damping, rdamping or 0, mat ~= "" and mat or "cable/cable2", width or 1, stretch ~= 0, color ) + local cons, rope = constraint.Elastic( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, constant, damping, rdamping or 0, mat ~= "" and mat or "cable/cable2", width and math.Clamp(width, 0, 50) or 1, stretch ~= 0, color ) if not verifyConstraint( self, cons ) then return end constraints[index] = cons @@ -361,7 +359,7 @@ local function createRope(self, index, ent1, ent2, v1, v2, bone1, bone2, addleng color = Color(color[1], color[2], color[3]) end - local cons, rope = constraint.Rope( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, length, addlength or 0, 0, width or 1, mat ~= "" and mat or "cable/rope", rigid ~= 0, color ) + local cons, rope = constraint.Rope( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, length, addlength or 0, 0, width and math.Clamp(width, 0, 50) or 1, mat ~= "" and mat or "cable/rope", rigid ~= 0, color ) if not verifyConstraint( self, cons ) then return end constraints[index] = cons @@ -488,7 +486,7 @@ local function createSlider(self, ent1, ent2, v1, v2, width, bone1, bone2, mat, color = Color(color[1],color[2],color[3],255) end - local cons, rope = constraint.Slider( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, width or 1, mat ~= "" and mat or "cable/cable2", color ) + local cons, rope = constraint.Slider( ent1, ent2, bone1 or 0, bone2 or 0, v1, v2, width and math.Clamp(width, 0, 50) or 1, mat ~= "" and mat or "cable/cable2", color ) if not verifyConstraint( self, cons ) then return end postCreate(self, "Slider", cons, rope)