Fix to some errors related to trying to switch gizmo mode when already using them and trying to draw attachment bones that don't exist yet

This commit is contained in:
penolakushari 2024-10-28 23:17:08 +03:00
parent 2b186a31a0
commit 82ecfe24fc
2 changed files with 6 additions and 4 deletions

View File

@ -1440,6 +1440,8 @@ local SkeletonData = {}
local function DrawRecursiveBones(ent, bone, bonenodes)
local mainpos = ent:GetBonePosition(bone)
mainpos = mainpos:ToScreen()
local nodecache = bonenodes[ent]
local nodeexist = nodecache and true or false
for _, boneid in ipairs(ent:GetChildBones(bone)) do
SkeletonData[boneid] = bone
@ -1450,8 +1452,8 @@ local function DrawRecursiveBones(ent, bone, bonenodes)
surface.DrawLine(mainpos.x, mainpos.y, pos.x, pos.y)
DrawRecursiveBones(ent, boneid, bonenodes)
local color
if bonenodes then
color = BONETYPE_COLORS[bonenodes[ent][boneid].Type]
if nodeexist and nodecache[boneid] then
color = BONETYPE_COLORS[nodecache[boneid].Type]
else
color = COLOR_RGMGREEN
end

View File

@ -127,7 +127,7 @@ numpad.Register("rgmAxisChangeStateRot", function(pl)
if not RAGDOLLMOVER[pl] then RAGDOLLMOVER[pl] = {} end
if not rgmMode[pl] then rgmMode[pl] = 1 end
if not pl:GetTool() then return end
if not pl:GetTool() or RAGDOLLMOVER[pl].Moving then return end
if pl:GetTool().Mode ~= "ragdollmover" or pl:GetActiveWeapon():GetClass() ~= "gmod_tool" then return end
if RotKey[pl] == ScaleKey[pl] then
rgmMode[pl] = rgmMode[pl] + 1
@ -147,7 +147,7 @@ end)
numpad.Register("rgmAxisChangeStateScale", function(pl)
if not RAGDOLLMOVER[pl] then RAGDOLLMOVER[pl] = {} end
if not pl:GetTool() then return end
if not pl:GetTool() or RAGDOLLMOVER[pl].Moving then return end
if pl:GetTool().Mode ~= "ragdollmover" or pl:GetActiveWeapon():GetClass() ~= "gmod_tool" then return end
if RotKey[pl] == ScaleKey[pl] then return end
RAGDOLLMOVER[pl].Scale = not RAGDOLLMOVER[pl].Scale