Use cached Game more for performance improvement (#879)

This commit is contained in:
kittenchilly authored and GitHub committed 2025-06-11 19:38:02 +02:00
1 parent 8a9c4358b7
commit 3c26ff782c
5 files changed
+14 -9

No files matched your search

+5 -3
View File
@@ -1,3 +1,5 @@
local game = Game()
EID.ButtonToIconMap = {
[ButtonAction.ACTION_SHOOTUP] = "{{ButtonY}}",
[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)
local function SwagColors(colors, maxAnimTime)
maxAnimTime = maxAnimTime or 80
local animTime = Game():GetFrameCount() % maxAnimTime
local animTime = game:GetFrameCount() % maxAnimTime
local colorFractions = (maxAnimTime - 1) / #colors
local subAnm = math.floor(animTime / (colorFractions + 1)) + 1
local primaryColorIndex = subAnm % (#colors + 1)
@@ -785,7 +787,7 @@ EID.InlineColors = {
-- Text will blink frequently
["ColorBlink"] = function(color)
local maxAnimTime = 40
local animTime = Game():GetFrameCount() % maxAnimTime
local animTime = game:GetFrameCount() % maxAnimTime
color = EID:copyKColor(color) or EID:getTextColor()
if animTime < maxAnimTime / 2 then
color.Alpha = 1 * color.Alpha
@@ -797,7 +799,7 @@ EID.InlineColors = {
-- Text will fade in and out
["ColorFade"] = function(color)
local maxAnimTime = 30
local animTime = Game():GetFrameCount() % (maxAnimTime + 10)
local animTime = game:GetFrameCount() % (maxAnimTime + 10)
color = EID:copyKColor(color) or EID:getTextColor()
if animTime < maxAnimTime / 2 then
color.Alpha = animTime / (maxAnimTime / 2) * color.Alpha