From 8b10acab090ddbc074c5d30094e95caa04e468f2 Mon Sep 17 00:00:00 2001 From: "born a rick, raised a morty, died a jerry" Date: Sat, 24 Nov 2018 18:29:06 -0500 Subject: [PATCH] update cdgraph lua side to update with rates --- .../BGAnimations/_chorddensitygraph.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Themes/Til Death/BGAnimations/_chorddensitygraph.lua b/Themes/Til Death/BGAnimations/_chorddensitygraph.lua index 17da340203..a3f5aaa5a8 100644 --- a/Themes/Til Death/BGAnimations/_chorddensitygraph.lua +++ b/Themes/Til Death/BGAnimations/_chorddensitygraph.lua @@ -23,22 +23,26 @@ local function makeABar(vertices, x, y, barWidth, barHeight, prettycolor) vertices[#vertices + 1] = {{x,y,0},prettycolor} end -local function getColorForDensity(density) +local function getColorForDensity(density, ncol) if density == 1 then return color(".75,.75,.75") -- nps color + elseif density == ncol then + return color(".1,.1,.1") -- biggest chord color elseif density == 2 then return color(".5,.5,.5") -- jumps color elseif density == 3 then return color(".25,.25,.25") -- hands color - else - return color(".1,.1,.1") -- quads color + --else + --local c = lerp(density / (ncol +1 ), .1, .75) -- im sure we can programmatically handle n columns but im too lazy + --return color(c..","..c..","..c..","..c) -- to make this look nice atm -mina end end local function updateGraphMultiVertex(parent, realgraph) local steps = GAMESTATE:GetCurrentSteps(PLAYER_1) if steps then - local graphVectors = steps:GetCDGraphVectors() + local ncol = steps:GetNumColumns() + local graphVectors = steps:GetCDGraphVectors(getCurRateValue()) if graphVectors == nil then -- reset everything if theres nothing to show realgraph:SetVertices({}) @@ -66,7 +70,7 @@ local function updateGraphMultiVertex(parent, realgraph) for density = 1,4 do for column = 1,numberOfColumns do if graphVectors[density][column] > 0 then - local barColor = getColorForDensity(density) + local barColor = getColorForDensity(density, ncol) makeABar(verts, column * columnWidth, yOffset, columnWidth, graphVectors[density][column] * 2 * hodth, barColor) end end @@ -86,6 +90,11 @@ local t = Def.ActorFrame { DelayedChartUpdateMessageCommand = function(self) self:queuecommand("GraphUpdate") end, + CurrentRateChangedMessageCommand = function(self) + if self:GetParent():GetVisible() then + self:queuecommand("GraphUpdate") + end + end, Def.Quad { Name = "cdbg", InitCommand = function(self)