From 14d8167d01c53acb4e382b05b85d5da225f89001 Mon Sep 17 00:00:00 2001 From: Buurazu Date: Sat, 22 Jan 2022 17:00:03 -0500 Subject: [PATCH] use two vars instead of a table --- main.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.lua b/main.lua index ae6083db..ad4e9a08 100644 --- a/main.lua +++ b/main.lua @@ -790,7 +790,7 @@ function EID:setPlayer() end end --- is this needed if pathchecker uses a no reward seed? +-- is this needed if pathchecker uses a no reward seed? (and isn't even present for a render?) if REPENTANCE then function EID:removeWrongGuppyEyeInfo(effectEntity) if EID.pathCheckerEntity ~= nil and effectEntity.Parent ~= nil then @@ -840,13 +840,14 @@ function EID:onGameUpdate() end EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate) -local lastPathfindCheck = { -1, -1 } +local lastPathfindIndex = -1 +local lastPathfindFrame = -1 local function attemptPathfind(entity) if (EID.Config["DisableObstructionOnFlight"] and EID.player.CanFly) then entity:GetData()["EID_Pathfound"] = true return true end - if entity.Index == lastPathfindCheck[1] and EID.GameUpdateCount - lastPathfindCheck[2] < 30 then return false end + if entity.Index == lastPathfindIndex and EID.GameUpdateCount - lastPathfindFrame < 30 then return false end -- Spawn a custom NPC entity to attempt a pathfind to the target pickup, then remove it afterwards EID.pathCheckerEntity = game:Spawn(17, 3169, EID.player.Position, nullVector, EID.player, 0, 4354) @@ -860,9 +861,8 @@ local function attemptPathfind(entity) EID.pathCheckerEntity.Position = EID.player.Position -- not needed, it spawned at our position? local success = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(entity.Position, false) entity:GetData()["EID_Pathfound"] = success - EID.pathCheckerEntity:Remove() - EID.pathCheckerEntity = nil - lastPathfindCheck = { entity.Index, EID.GameUpdateCount } + EID.pathCheckerEntity:Remove(); EID.pathCheckerEntity = nil + lastPathfindIndex = entity.Index; lastPathfindFrame = EID.GameUpdateCount return success end