From 26ba64218b570f84f53a74ab3b06a1303aa7e6e9 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 18 Jul 2021 18:26:15 +0200 Subject: [PATCH] fix: remove input lag from QTE --- .../controllers/fighters/systems/choregraphy/init.lua | 10 ++++++++-- .../fighters/systems/choregraphy/qte/parent.lua | 9 ++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua index acacedb..0e196ec 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua @@ -26,6 +26,7 @@ function ChoregraphySystem:new(action, choregraphy) self.qte = {} self.qte.current = nil self.qte.wasSuccess = false + self.qte.isActive = false self.qte.list = {} self.finishedTagActions = {} @@ -34,7 +35,7 @@ end function ChoregraphySystem:update(dt) if (self.qte.current ~= nil) then - self.qte.current:updateQte(dt) + self.qte.current:updateQte(dt, self.qte.isActive) end if (self.currentStep ~= nil) then @@ -104,6 +105,7 @@ function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess, tag self.qte.current:blockAction(action, blockProcess) self.qte.current:setOrigin(origin) self.qte.current:setTag(tag) + self.qte.isActive = true end end @@ -113,12 +115,16 @@ function ChoregraphySystem:isQteSuccess(qteID) end function ChoregraphySystem:endQte(success) - self.qte.current = nil + self.qte.isActive = false self.qte.wasSuccess = success table.insert(self.qte.list, success) end +function ChoregraphySystem:removeQte() + self.qte.current = nil +end + function ChoregraphySystem:testTagAction(tag, statut) local tagStatut = self.finishedTagActions[tag] or 0 return (statut <= tagStatut) diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua index 8429ae3..8b20d89 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua @@ -60,7 +60,7 @@ function QteParent:setOrigin(origin) end end -function QteParent:updateQte(dt) +function QteParent:updateQte(dt, isActive) if (not self.isStarted) then self:start() self.isStarted = true @@ -68,7 +68,9 @@ function QteParent:updateQte(dt) self:update(dt) self.tweens:update(dt) self.prompts:update(dt) - self:verifyPrompts() + if (isActive) then + self:verifyPrompts() + end end end @@ -84,7 +86,7 @@ function QteParent:timerResponse(timer) self.timerActive = true self.prompts.defaultTimerValue = 0 elseif (timer == "endQte") then - self:endQte() + self.choregraphy:removeQte() end end @@ -92,6 +94,7 @@ function QteParent:finish(success) self.isSuccess = success self.timerActive = false self.tweens:newTimer(self.prompts.BEGINTIME, "endQte") + self:endQte() end function QteParent:verifyPrompts()