Fixed highlighting function on Mega chest entities and made highlights only apply to the item, not the pedestal of items

This commit is contained in:
Wofsauge committed 2021-10-31 18:20:01 +01:00
1 parent 5d700d6e29
commit 5c1719e459
2 files changed
+54 -44

No files matched your search

+41 -31
View File
@@ -9,7 +9,7 @@ local game = Game()
require("eid_config") require("eid_config")
EID.Config = EID.UserConfig EID.Config = EID.UserConfig
EID.Config.Version = "3.2" EID.Config.Version = "3.2"
EID.ModVersion = "3.85" EID.ModVersion = "3.87"
EID.DefaultConfig.Version = EID.Config.Version EID.DefaultConfig.Version = EID.Config.Version
EID.isHidden = false EID.isHidden = false
EID.player = nil EID.player = nil
@@ -404,6 +404,9 @@ function EID:renderIndicator(entity)
end end
local repDiv = 1 local repDiv = 1
local entityPos = Isaac.WorldToScreen(entity.Position) local entityPos = Isaac.WorldToScreen(entity.Position)
if entity:GetData() and entity:GetData()["EID_RenderOffset"] then
entityPos = entityPos + entity:GetData()["EID_RenderOffset"]
end
local sprite = entity:GetSprite() local sprite = entity:GetSprite()
if REPENTANCE then if REPENTANCE then
repDiv = 255 repDiv = 255
@@ -416,25 +419,8 @@ function EID:renderIndicator(entity)
if EID.Config["Indicator"] == "blink" then if EID.Config["Indicator"] == "blink" then
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40)) local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv) sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv)
sprite:Render(entityPos, nullVector, nullVector) EID:renderEntity(entity, sprite, entityPos)
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0) sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
elseif EID.Config["Indicator"] == "border" then
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv)
sprite:Render(entityPos + Vector(0, 1), nullVector, nullVector)
sprite:Render(entityPos + Vector(0, -1), nullVector, nullVector)
sprite:Render(entityPos + Vector(1, 0), nullVector, nullVector)
sprite:Render(entityPos + Vector(-1, 0), nullVector, nullVector)
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
sprite:Render(entityPos, nullVector, nullVector)
elseif EID.Config["Indicator"] == "highlight" then
sprite.Color = Color(1, 1, 1, 1, 255/repDiv, 255/repDiv, 255/repDiv)
sprite:Render(entityPos + Vector(0, 1), nullVector, nullVector)
sprite:Render(entityPos + Vector(0, -1), nullVector, nullVector)
sprite:Render(entityPos + Vector(1, 0), nullVector, nullVector)
sprite:Render(entityPos + Vector(-1, 0), nullVector, nullVector)
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
sprite:Render(entityPos, nullVector, nullVector)
elseif EID.Config["Indicator"] == "arrow" then elseif EID.Config["Indicator"] == "arrow" then
ArrowSprite:Update() ArrowSprite:Update()
local ArrowOffset = Vector(0, -35) local ArrowOffset = Vector(0, -35)
@@ -442,6 +428,19 @@ function EID:renderIndicator(entity)
ArrowOffset = Vector(0, -62) ArrowOffset = Vector(0, -62)
end end
ArrowSprite:Render(Isaac.WorldToScreen(entity.Position + ArrowOffset), nullVector, nullVector) ArrowSprite:Render(Isaac.WorldToScreen(entity.Position + ArrowOffset), nullVector, nullVector)
else
if EID.Config["Indicator"] == "border" then
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv)
elseif EID.Config["Indicator"] == "highlight" then
sprite.Color = Color(1, 1, 1, 1, 255/repDiv, 255/repDiv, 255/repDiv)
end
EID:renderEntity(entity, sprite, entityPos + Vector(0, 1))
EID:renderEntity(entity, sprite, entityPos +Vector(0, -1))
EID:renderEntity(entity, sprite, entityPos + Vector(1, 0))
EID:renderEntity(entity, sprite, entityPos + Vector(-1, 0))
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
EID:renderEntity(entity, sprite, entityPos)
end end
if REPENTANCE then if REPENTANCE then
if isMirrorRoom then if isMirrorRoom then
@@ -450,6 +449,15 @@ function EID:renderIndicator(entity)
end end
end end
function EID:renderEntity(entity, sprite, position)
if entity.Type == 5 and entity.Variant == 100 then
sprite:RenderLayer(1, position, nullVector, nullVector)
else
sprite:Render(position, nullVector, nullVector)
end
end
function EID:renderHUDLocationIndicators() function EID:renderHUDLocationIndicators()
local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2 local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2
Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 ) Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 )
@@ -497,6 +505,20 @@ EID.hasValidWalkingpath = true
function EID:onGameUpdate() function EID:onGameUpdate()
EID.player = Isaac.GetPlayer(0) EID.player = Isaac.GetPlayer(0)
--Fix Overlapping Pedestals
local curPositions = {}
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
local pos = entity.Position
for _, otherPos in ipairs(curPositions) do
if pos:Distance(otherPos[2]) == 0 then
entity.Position = entity.Position + Vector(1,0)
entity:GetData()["EID_RenderOffset"] = Vector(10,0)
otherPos[1]:GetData()["EID_RenderOffset"] = Vector(-10,0)
end
end
table.insert(curPositions, {entity, entity.Position})
end
if not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedPillInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"] then if not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedPillInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"] then
if EID.lastDescriptionEntity == nil or (EID.Config["DisableObstructionOnFlight"] and EID.player.CanFly) then if EID.lastDescriptionEntity == nil or (EID.Config["DisableObstructionOnFlight"] and EID.player.CanFly) then
if EID.pathCheckerEntity ~= nil then if EID.pathCheckerEntity ~= nil then
@@ -520,18 +542,6 @@ function EID:onGameUpdate()
end end
end end
--Fix Overlapping Pedestals
local curPositions = {}
for _, entity in ipairs(Isaac.FindByType(5, 100, -1, true, false)) do
local pos = entity.Position
for _, otherPos in ipairs(curPositions) do
if pos:Distance(otherPos) == 0 then
entity.Position = entity.Position + Vector(1,0)
break
end
end
table.insert(curPositions, entity.Position)
end
end end
EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate) EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
+13 -13
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<metadata> <metadata>
<name>!!~External item descriptions</name> <name>!!~External item descriptions</name>
<directory>external item descriptions</directory> <directory>external item descriptions</directory>
<id>836319872</id> <id>836319872</id>
<description>[img]https://i.imgur.com/l9nbaxP.png[/img] <description>[img]https://i.imgur.com/l9nbaxP.png[/img]
This mod displays detailed information about all items, trinkets, cards, runes and pills DIRECTLY onto your screen. Say goodbye to your browsertab with platinumgod open ;) This mod displays detailed information about all items, trinkets, cards, runes and pills DIRECTLY onto your screen. Say goodbye to your browsertab with platinumgod open ;)
@@ -90,13 +90,13 @@ https://moddingofisaac.com/mod/1079/external-item-descriptions
- Jake for the sweet [b]German[/b] language pack - Jake for the sweet [b]German[/b] language pack
- [url=https://steamcommunity.com/id/whytefang/]adc[/url] for creating an awesome new Languagepack and providing ideas for new functionalities - [url=https://steamcommunity.com/id/whytefang/]adc[/url] for creating an awesome new Languagepack and providing ideas for new functionalities
</description> </description>
<version>3.85</version> <version>3.87</version>
<visibility>Public</visibility> <visibility>Public</visibility>
<tag id="Lua"/> <tag id="Lua"/>
<tag id="Items"/> <tag id="Items"/>
<tag id="Active Items"/> <tag id="Active Items"/>
<tag id="Trinkets"/> <tag id="Trinkets"/>
<tag id="Pills"/> <tag id="Pills"/>
<tag id="Cards"/> <tag id="Cards"/>
<tag id="Tweaks"/> <tag id="Tweaks"/>
</metadata> </metadata>