Removed custom pathchecker entity since its not needed anymore

This commit is contained in:
Wofsauge committed 2022-02-03 22:39:24 +01:00
1 parent 1d4aa87300
commit 9c99b2eecf
4 files changed
+3 -54

No files matched your search

+3 -10
View File
@@ -893,16 +893,9 @@ local function attemptPathfind(entity)
-- Don't reattempt pathfinding more than 3 times a second, unless this is a new entity
if pathsChecked[entity.InitSeed] == false and EID.GameUpdateCount - lastPathfindFrame < 10 then return false end
-- Spawn a custom NPC entity to attempt a pathfind to the target pickup, then remove it afterwards
pathCheckerEntity = game:Spawn(17, 3169, EID.player.Position, nullVector, EID.player, 0, 4354)
pathCheckerEntity:ClearEntityFlags(EntityFlag.FLAG_APPEAR)
-- Not sure how much of this flagging is needed now that the entity is immediately removed afterwards
pathCheckerEntity:AddEntityFlags(EntityFlag.FLAG_PERSISTENT | EntityFlag.FLAG_NO_STATUS_EFFECTS | EntityFlag.FLAG_NO_SPRITE_UPDATE | EntityFlag.FLAG_HIDE_HP_BAR | EntityFlag.FLAG_NO_DEATH_TRIGGER | EntityFlag.FLAG_FRIENDLY)
if REPENTANCE then pathCheckerEntity:AddEntityFlags(EntityFlag.FLAG_NO_QUERY) end -- can it even be queried in this brief time?
pathCheckerEntity.EntityCollisionClass = EntityCollisionClass.ENTCOLL_NONE
pathCheckerEntity.Visible = false -- it's invisible anyway?
pathCheckerEntity.Position = EID.player.Position -- not needed, it spawned at our position?
-- Spawn a Shopkeeper entity to attempt a pathfind to the target pickup, then remove it afterwards
pathCheckerEntity = game:Spawn(17, 0, EID.player.Position, nullVector, EID.player, 0, 4354)
local success = pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos(entity.Position, false)
pathsChecked[entity.InitSeed] = success
pathCheckerEntity:Remove()