Skip to content

Commit 4935f04

Browse files
committed
Fixed: Minor run-time errors
1 parent 5526191 commit 4935f04

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

lua/autorun/gearassembly_init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ local asmlib = gearasmlib
2525

2626
------ CONFIGURE ASMLIB ------
2727
asmlib.InitBase("gear","assembly")
28-
asmlib.SetOpVar("TOOL_VERSION","5.189")
28+
asmlib.SetOpVar("TOOL_VERSION","5.190")
2929
asmlib.SetIndexes("V",1,2,3)
3030
asmlib.SetIndexes("A",1,2,3)
3131
asmlib.SetIndexes("S",4,5,6,7)
@@ -117,8 +117,8 @@ if(SERVER) then
117117
end)
118118

119119
asmlib.SetAction("PLAYER_QUIT",
120-
function(oPly)
121-
if(not asmlib.ClearCachePly(oPly)) then
120+
function(oPly) -- Clear player cache when disconnects
121+
if(not asmlib.CacheClearPly(oPly)) then
122122
return asmlib.StatusLog(nil,"PLAYER_QUIT: Failed swiping stuff "..tostring(oPly)) end
123123
return asmlib.StatusLog(nil,"PLAYER_QUIT: Success")
124124
end)

lua/gearassembly/gearasmlib.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,12 +1409,12 @@ local function CacheSpawnPly(pPly)
14091409
end; return plyData
14101410
end
14111411

1412-
function ClearCachePly(pPly)
1412+
function CacheClearPly(pPly)
14131413
if(not IsPlayer(pPly)) then
1414-
return StatusLog(false,"ClearCachePly: Player <"..tostring(pPly)"> invalid") end
1414+
return StatusLog(false,"CacheClearPly: Player <"..tostring(pPly)"> invalid") end
14151415
local plyPlace = libPlayer[pPly]
14161416
if(not IsExistent(plyPlace)) then
1417-
return StatusLog(true,"ClearCachePly: Clean") end
1417+
return StatusLog(true,"CacheClearPly: Clean") end
14181418
plyTable[pPly] = nil; collectgarbage(); return true
14191419
end
14201420

@@ -1432,7 +1432,7 @@ function CacheRadiusPly(pPly, vHit, nSca)
14321432
if(not IsExistent(plyData)) then
14331433
LogInstance("CacheRadiusPly: Malloc <"..pPly:Nick()..">")
14341434
plyPlace["RADIUS"] = {}; plyData = plyPlace["RADIUS"]
1435-
plyData["MAR"] = (GetOpVar("GOLDEN_RATIO") * 1000),
1435+
plyData["MAR"] = (GetOpVar("GOLDEN_RATIO") * 1000)
14361436
plyData["LIM"] = ((GetOpVar("GOLDEN_RATIO") - 1) * 100)
14371437
end
14381438
local nMul = (tonumber(nSca) or 1) -- Disable scaling on missing or outside
@@ -1447,7 +1447,7 @@ function CacheTracePly(pPly)
14471447
local plyPlace = GetPlacePly(pPly)
14481448
if(not IsExistent(plyPlace)) then
14491449
return StatusLog(nil,"CacheTracePly: Place missing") end
1450-
local plyData = plyPlace["TRACE"]
1450+
local plyData, plyTime = plyPlace["TRACE"], Time()
14511451
if(not IsExistent(plyData)) then -- Define trace delta margin
14521452
LogInstance("CacheTracePly: Malloc <"..pPly:Nick()..">")
14531453
plyPlace["TRACE"] = {}; plyData = plyPlace["TRACE"]
@@ -2863,7 +2863,7 @@ function GetEntitySpawn(oPly,trEnt,trPivot,hdPivot,hdModel,enIgnTyp,enOrAngTr,
28632863
-- Calculate the origin based on the center
28642864
stSpawn.OPos:Set(stSpawn.TPnt); stSpawn.OPos:Add(stSpawn.TMas)
28652865
stSpawn.OAng:Set(stSpawn.TAng); stSpawn.OAng:RotateAroundAxis(stSpawn.TAng:Right(),trRec.Rake)
2866-
return GetNormalSpawn(nil,nil,hdModel,hdPivot,enOrAngTr,ucsPosX,ucsPosY,ucsPosZ,ucsAngP,ucsAngY,ucsAngR)
2866+
return GetNormalSpawn(oPly,nil,nil,hdModel,hdPivot,enOrAngTr,ucsPosX,ucsPosY,ucsPosZ,ucsAngP,ucsAngY,ucsAngR)
28672867
end
28682868

28692869
local function GetEntityOrTrace(oEnt)

lua/weapons/gmod_tool/stools/gearassembly.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local LocalPlayer = LocalPlayer
1313
local GetConVar = GetConVar
1414
local RunConsoleCommand = RunConsoleCommand
1515
local osDate = os and os.date
16+
local hookAdd = hook and hook.Add
1617
local mathFloor = math and math.floor
1718
local mathClamp = math and math.Clamp
1819
local vguiCreate = vgui and vgui.Create
@@ -86,7 +87,7 @@ end
8687

8788
if(SERVER) then
8889
cleanupRegister(gsLimitName)
89-
hookAdd("PlayerDisconnected", gsToolPrefL.."player_quit", asmlib.GetActionCode("PLAYER_QUIT")))
90+
hookAdd("PlayerDisconnected", gsToolPrefL.."player_quit", asmlib.GetActionCode("PLAYER_QUIT"))
9091
duplicatorRegisterEntityModifier(gsToolPrefL.."dupe_phys_set",asmlib.GetActionCode("DUPE_PHYS_SETTINGS"))
9192
end
9293

@@ -715,7 +716,7 @@ function TOOL:DrawHUD()
715716
else
716717
local vPos = stTrace.HitPos
717718
local aAng = asmlib.GetNormalAngle(oPly, stTrace)
718-
local stSpawn = asmlib.GetNormalSpawn(oPly,vPos,aAng,model,rotpivh,trorang,nextx,nexty,nextz,nextpic,nextyaw,nextrol)
719+
local stSpawn = asmlib.GetNormalSpawn(oPly,vPos,aAng,model,rotpivh,trorang,nextx,nexty,nextz,nextpic,nextyaw,nextrol)
719720
if(not stSpawn) then return false end
720721
local Op = self:DrawUCS(hudMonitor, stSpawn.OPos, stSpawn.F:AngleEx(stSpawn.U), plyrad, "y", true)
721722
if(not spnflat) then

0 commit comments

Comments
 (0)