From 5f1fea75ad4f1a188e91a01ea51ab907e309f0ca Mon Sep 17 00:00:00 2001 From: vlazed Date: Mon, 23 Dec 2024 09:57:33 -0600 Subject: [PATCH] Do subtraction of maxdist before loop --- lua/autorun/ragdollmover.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/autorun/ragdollmover.lua b/lua/autorun/ragdollmover.lua index 3c50fe2..2628d7c 100644 --- a/lua/autorun/ragdollmover.lua +++ b/lua/autorun/ragdollmover.lua @@ -1133,6 +1133,7 @@ function AdvBoneSelectRender(ent, bonenodes) if not maxdist or maxdist < dist then maxdist = dist end bonedistances[i] = dist end + maxdist = maxdist - mindist local selectedBones = {} for i = 0, ent:GetBoneCount() - 1 do @@ -1156,7 +1157,7 @@ function AdvBoneSelectRender(ent, bonenodes) table.insert(selectedBones, {name, i}) else if nodesExist and bonenodes[ent][i] and bonenodes[ent][i].Type then - local fraction = ( bonedistances[i] - mindist ) / (maxdist - mindist) + local fraction = ( bonedistances[i] - mindist ) / maxdist fraction = math.max(1, math.ceil(fraction * NUM_GRADIENT_POINTS)) surface.SetDrawColor(BONETYPE_COLORS[bonenodes[ent][i].Type][fraction]:Unpack()) else