Fix 1-frame obstruction flaws for real this time
This commit is contained in:
1 parent
6e7ef1a661
commit
10ce89cd7f
1 file changed
+21
-5
@@ -563,6 +563,7 @@ EID.lastDescriptionEntity = nil
|
|||||||
EID.lastDist = 0
|
EID.lastDist = 0
|
||||||
EID.pathCheckerEntity = nil
|
EID.pathCheckerEntity = nil
|
||||||
EID.hasValidWalkingpath = true
|
EID.hasValidWalkingpath = true
|
||||||
|
EID.pathfindingTo = nil
|
||||||
|
|
||||||
function EID:onGameUpdate()
|
function EID:onGameUpdate()
|
||||||
EID:setPlayer()
|
EID:setPlayer()
|
||||||
@@ -573,7 +574,7 @@ function EID:onGameUpdate()
|
|||||||
local pos = entity.Position
|
local pos = entity.Position
|
||||||
for _, otherPos in ipairs(curPositions) do
|
for _, otherPos in ipairs(curPositions) do
|
||||||
if pos:Distance(otherPos[2]) == 0 then
|
if pos:Distance(otherPos[2]) == 0 then
|
||||||
entity.Position = entity.Position + Vector(1,0)
|
--entity.Position = entity.Position + Vector(1,0)
|
||||||
entity:GetData()["EID_RenderOffset"] = Vector(10,0)
|
entity:GetData()["EID_RenderOffset"] = Vector(10,0)
|
||||||
otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0)
|
otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0)
|
||||||
end
|
end
|
||||||
@@ -598,6 +599,7 @@ function EID:onGameUpdate()
|
|||||||
EID.pathCheckerEntity = nil
|
EID.pathCheckerEntity = nil
|
||||||
EID.hasValidWalkingpath = true
|
EID.hasValidWalkingpath = true
|
||||||
end
|
end
|
||||||
|
EID.pathfindingTo = EID.lastDescriptionEntity
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if EID.pathCheckerEntity == nil then
|
if EID.pathCheckerEntity == nil then
|
||||||
@@ -609,16 +611,24 @@ function EID:onGameUpdate()
|
|||||||
EID.hasValidWalkingpath = false
|
EID.hasValidWalkingpath = false
|
||||||
elseif not EID.pathCheckerEntity:Exists() then
|
elseif not EID.pathCheckerEntity:Exists() then
|
||||||
EID.pathCheckerEntity = nil
|
EID.pathCheckerEntity = nil
|
||||||
EID.hasValidWalkingpath = false
|
|
||||||
else
|
else
|
||||||
EID.pathCheckerEntity.Position = EID.player.Position
|
EID.pathCheckerEntity.Position = EID.player.Position
|
||||||
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
|
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
|
||||||
|
EID.pathfindingTo = EID.lastDescriptionEntity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
|
EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
|
||||||
|
|
||||||
|
-- this can be called when moving between two different pickups
|
||||||
|
function EID:updatePathfinding()
|
||||||
|
if not EID.pathCheckerEntity or not EID.lastDescriptionEntity then return end
|
||||||
|
EID.pathCheckerEntity.Position = EID.player.Position
|
||||||
|
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
|
||||||
|
EID.pathfindingTo = EID.lastDescriptionEntity
|
||||||
|
end
|
||||||
|
|
||||||
local hasShownAchievementWarning = false
|
local hasShownAchievementWarning = false
|
||||||
|
|
||||||
local function renderAchievementInfo()
|
local function renderAchievementInfo()
|
||||||
@@ -815,6 +825,8 @@ local function onRender(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if EID.pathfindingTo and EID.pathfindingTo.Index ~= closest.Index then EID:updatePathfinding() end
|
||||||
|
|
||||||
if closest.Variant == PickupVariant.PICKUP_TRINKET then
|
if closest.Variant == PickupVariant.PICKUP_TRINKET then
|
||||||
--Handle Trinkets
|
--Handle Trinkets
|
||||||
local trinketID = closest.SubType
|
local trinketID = closest.SubType
|
||||||
@@ -833,7 +845,8 @@ local function onRender(t)
|
|||||||
EID:printDescription(descriptionObj)
|
EID:printDescription(descriptionObj)
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
||||||
--Handle Cards & Runes
|
--Handle Cards & Runes
|
||||||
if ( not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"]) and closest.FrameCount < 3 then
|
if (not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"]) and
|
||||||
|
(closest.FrameCount < 3 or EID.pathfindingTo == nil) then
|
||||||
-- small delay when having obstruction enabled & entering the room to prevent spoilers
|
-- small delay when having obstruction enabled & entering the room to prevent spoilers
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -851,13 +864,16 @@ local function onRender(t)
|
|||||||
EID:printDescription(descriptionObj)
|
EID:printDescription(descriptionObj)
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_PILL then
|
elseif closest.Variant == PickupVariant.PICKUP_PILL then
|
||||||
--Handle Pills
|
--Handle Pills
|
||||||
if not EID.Config["DisplayObstructedPillInfo"] and closest.FrameCount < 3 then
|
if not EID.Config["DisplayObstructedPillInfo"] and
|
||||||
|
(closest.FrameCount < 3 or EID.pathfindingTo == nil) then
|
||||||
-- small delay when having obstruction enabled & entering the room to prevent spoilers
|
-- small delay when having obstruction enabled & entering the room to prevent spoilers
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if EID:getEntityData(closest, "EID_DontHide") ~= true then
|
if EID:getEntityData(closest, "EID_DontHide") ~= true then
|
||||||
|
local hideinShop = closest:ToPickup():IsShopItem() and not EID.Config["DisplayPillInfoShop"]
|
||||||
local isOptionsSpawn = REPENTANCE and not EID.Config["DisplayPillInfoOptions?"] and closest:ToPickup().OptionsPickupIndex > 0
|
local isOptionsSpawn = REPENTANCE and not EID.Config["DisplayPillInfoOptions?"] and closest:ToPickup().OptionsPickupIndex > 0
|
||||||
if isOptionsSpawn or (closest:ToPickup():IsShopItem() and not EID.Config["DisplayPillInfoShop"]) or (not EID.Config["DisplayObstructedPillInfo"] and not EID.hasValidWalkingpath) then
|
local obstructed = not EID.Config["DisplayObstructedPillInfo"] and not EID.hasValidWalkingpath
|
||||||
|
if isOptionsSpawn or hideinShop or obstructed then
|
||||||
EID:renderQuestionMark()
|
EID:renderQuestionMark()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user