Use cached Game more for performance improvement (#879)
This commit is contained in:
1 parent
8a9c4358b7
commit
3c26ff782c
5 files changed
+14
-9
No files matched your search
@@ -333,7 +333,7 @@ function EID:IsGreedMode()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EID:IsGreedModePlusTarot()
|
function EID:IsGreedModePlusTarot()
|
||||||
return game:IsGreedMode() and EID:ConditionalItemCheck(451, true)
|
return EID:IsGreedMode() and EID:ConditionalItemCheck(451, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EID:PlayersHaveRestock()
|
function EID:PlayersHaveRestock()
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
local game = Game()
|
||||||
|
|
||||||
EID.ButtonToIconMap = {
|
EID.ButtonToIconMap = {
|
||||||
[ButtonAction.ACTION_SHOOTUP] = "{{ButtonY}}",
|
[ButtonAction.ACTION_SHOOTUP] = "{{ButtonY}}",
|
||||||
[ButtonAction.ACTION_SHOOTDOWN] = "{{ButtonA}}",
|
[ButtonAction.ACTION_SHOOTDOWN] = "{{ButtonA}}",
|
||||||
@@ -675,7 +677,7 @@ EID.InlineIcons["Tearsize"] = EID.isRepentance and EID.InlineIcons["TearsizeREP"
|
|||||||
-- Function for handling colors that fade between multiple different colors (rainbow, gold, tarot cloth purple)
|
-- Function for handling colors that fade between multiple different colors (rainbow, gold, tarot cloth purple)
|
||||||
local function SwagColors(colors, maxAnimTime)
|
local function SwagColors(colors, maxAnimTime)
|
||||||
maxAnimTime = maxAnimTime or 80
|
maxAnimTime = maxAnimTime or 80
|
||||||
local animTime = Game():GetFrameCount() % maxAnimTime
|
local animTime = game:GetFrameCount() % maxAnimTime
|
||||||
local colorFractions = (maxAnimTime - 1) / #colors
|
local colorFractions = (maxAnimTime - 1) / #colors
|
||||||
local subAnm = math.floor(animTime / (colorFractions + 1)) + 1
|
local subAnm = math.floor(animTime / (colorFractions + 1)) + 1
|
||||||
local primaryColorIndex = subAnm % (#colors + 1)
|
local primaryColorIndex = subAnm % (#colors + 1)
|
||||||
@@ -785,7 +787,7 @@ EID.InlineColors = {
|
|||||||
-- Text will blink frequently
|
-- Text will blink frequently
|
||||||
["ColorBlink"] = function(color)
|
["ColorBlink"] = function(color)
|
||||||
local maxAnimTime = 40
|
local maxAnimTime = 40
|
||||||
local animTime = Game():GetFrameCount() % maxAnimTime
|
local animTime = game:GetFrameCount() % maxAnimTime
|
||||||
color = EID:copyKColor(color) or EID:getTextColor()
|
color = EID:copyKColor(color) or EID:getTextColor()
|
||||||
if animTime < maxAnimTime / 2 then
|
if animTime < maxAnimTime / 2 then
|
||||||
color.Alpha = 1 * color.Alpha
|
color.Alpha = 1 * color.Alpha
|
||||||
@@ -797,7 +799,7 @@ EID.InlineColors = {
|
|||||||
-- Text will fade in and out
|
-- Text will fade in and out
|
||||||
["ColorFade"] = function(color)
|
["ColorFade"] = function(color)
|
||||||
local maxAnimTime = 30
|
local maxAnimTime = 30
|
||||||
local animTime = Game():GetFrameCount() % (maxAnimTime + 10)
|
local animTime = game:GetFrameCount() % (maxAnimTime + 10)
|
||||||
color = EID:copyKColor(color) or EID:getTextColor()
|
color = EID:copyKColor(color) or EID:getTextColor()
|
||||||
if animTime < maxAnimTime / 2 then
|
if animTime < maxAnimTime / 2 then
|
||||||
color.Alpha = animTime / (maxAnimTime / 2) * color.Alpha
|
color.Alpha = animTime / (maxAnimTime / 2) * color.Alpha
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
local game = Game()
|
||||||
local showDebugChars = false
|
local showDebugChars = false
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ EID:removeIgnoredEntity(5,100,10) -- un-Ignore "Halo of flies" collectible entit
|
|||||||
EID:addColor("ColorTwitterBlue", KColor(0, 0.671875, 0.9296875, 1), nil)
|
EID:addColor("ColorTwitterBlue", KColor(0, 0.671875, 0.9296875, 1), nil)
|
||||||
EID:addColor("ColorBlackBlink", nil, function(color)
|
EID:addColor("ColorBlackBlink", nil, function(color)
|
||||||
local maxAnimTime = 30
|
local maxAnimTime = 30
|
||||||
local animTime = Game():GetFrameCount() % maxAnimTime
|
local animTime = game:GetFrameCount() % maxAnimTime
|
||||||
color = EID:copyKColor(color) or EID:getTextColor()
|
color = EID:copyKColor(color) or EID:getTextColor()
|
||||||
if animTime < maxAnimTime / 2 then
|
if animTime < maxAnimTime / 2 then
|
||||||
color = KColor(0, 0, 0, 1 * color.Alpha)
|
color = KColor(0, 0, 0, 1 * color.Alpha)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
local game = Game()
|
||||||
|
|
||||||
--------------- Grid entity description modifiers ---------------
|
--------------- Grid entity description modifiers ---------------
|
||||||
|
|
||||||
-- Table containing grid entity description handlers
|
-- Table containing grid entity description handlers
|
||||||
@@ -90,7 +92,7 @@ end
|
|||||||
-- Handle Sacrifice room payout
|
-- Handle Sacrifice room payout
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
local function SacrificeRoomCondition(_)
|
local function SacrificeRoomCondition(_)
|
||||||
return Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"]
|
return game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"]
|
||||||
end
|
end
|
||||||
|
|
||||||
local function SacrificeRoomCallback(descObj)
|
local function SacrificeRoomCallback(descObj)
|
||||||
@@ -103,7 +105,7 @@ local function SacrificeRoomCallback(descObj)
|
|||||||
local curCounter = descObj.ObjSubType or 1
|
local curCounter = descObj.ObjSubType or 1
|
||||||
if curCounter <= 2 then
|
if curCounter <= 2 then
|
||||||
--Remove B1 Bomb drop info when not on B1
|
--Remove B1 Bomb drop info when not on B1
|
||||||
if Game():GetLevel():GetAbsoluteStage() > 1 then
|
if game:GetLevel():GetAbsoluteStage() > 1 then
|
||||||
local splitPoint = string.find(descObj.Description, '#', 1)
|
local splitPoint = string.find(descObj.Description, '#', 1)
|
||||||
descObj.Description = descObj.Description:sub(1,splitPoint-1)
|
descObj.Description = descObj.Description:sub(1,splitPoint-1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -173,14 +173,14 @@ EID.ItemReminderDescriptionModifier = {
|
|||||||
local inAscent = EID.isRepentance and (level:IsAscent() or level:IsPreAscent())
|
local inAscent = EID.isRepentance and (level:IsAscent() or level:IsPreAscent())
|
||||||
local final = not level:IsNextStageAvailable()
|
local final = not level:IsNextStageAvailable()
|
||||||
|
|
||||||
if EID:IsGreedMode() then
|
if game:IsGreedMode() then
|
||||||
skip = 1
|
skip = 1
|
||||||
if stageNum == 5 then skip = 0 -- Depths 2 -> Womb 1
|
if stageNum == 5 then skip = 0 -- Depths 2 -> Womb 1
|
||||||
elseif stageNum == 7 or stageNum == 10 then skip = 2
|
elseif stageNum == 7 or stageNum == 10 then skip = 2
|
||||||
elseif stageNum == 0 then count = 1 end -- Womb 1 -> Sheol, Sheol -> Chest
|
elseif stageNum == 0 then count = 1 end -- Womb 1 -> Sheol, Sheol -> Chest
|
||||||
else
|
else
|
||||||
if final or stageNum == 12 then count = 1 -- Dark Room/Chest/The Void/Home/Corpse 2 doesn't display any more
|
if final or stageNum == 12 then count = 1 -- Dark Room/Chest/The Void/Home/Corpse 2 doesn't display any more
|
||||||
elseif EID:IsGreedMode() then count = 2 -- prevent Greed Mode Sheol from behaving weird
|
elseif game:IsGreedMode() then count = 2 -- prevent Greed Mode Sheol from behaving weird
|
||||||
elseif stageNum == 8 then count = 3; skip = 1 -- Womb 2 displays Sheol and Cathe
|
elseif stageNum == 8 then count = 3; skip = 1 -- Womb 2 displays Sheol and Cathe
|
||||||
elseif stageNum == 9 then count = 3 -- ??? displays Sheol and Cathe
|
elseif stageNum == 9 then count = 3 -- ??? displays Sheol and Cathe
|
||||||
elseif stageNum == 10 then skip = 1 end -- Sheol/Cathe skip one to display Dark Room/Chest
|
elseif stageNum == 10 then skip = 1 end -- Sheol/Cathe skip one to display Dark Room/Chest
|
||||||
|
|||||||
Reference in new issue
Block a user