From becd4aace578607441b7e055defab5325e129f1a Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 14 Aug 2019 16:22:43 +0200 Subject: [PATCH] fix(core): finally fix key flushing correctly --- sonic-radiance.love/core/input.lua | 2 ++ sonic-radiance.love/core/modules/scenes.lua | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sonic-radiance.love/core/input.lua b/sonic-radiance.love/core/input.lua index 21e5f70..4653aa1 100644 --- a/sonic-radiance.love/core/input.lua +++ b/sonic-radiance.love/core/input.lua @@ -41,6 +41,8 @@ function InputManager:initSources() local source = VirtualPad(self, sourceid, data) table.insert(self.sources, source) end + + self.fakekeys = self:getKeyList(1) end -- INFO FUNCTIONS diff --git a/sonic-radiance.love/core/modules/scenes.lua b/sonic-radiance.love/core/modules/scenes.lua index 37481dc..e0597e0 100644 --- a/sonic-radiance.love/core/modules/scenes.lua +++ b/sonic-radiance.love/core/modules/scenes.lua @@ -140,10 +140,10 @@ function Scene:setKeys() if (self.inputLockedTimer <= 0 ) then self.inputLocked = false end - self.menusystem.keys = self.sources[1].fakekeys + self.menusystem.keys = self:getKeys(1) else self.sources = core.input.sources - self.menusystem.keys = self.sources[1].keys + self.menusystem.keys = self:getKeys(1) end end @@ -153,17 +153,19 @@ function Scene:getKeys(sourceid) end local sourceid = sourceid or 1 + if (self.inputLocked) then - return self.sources[sourceid].keys - else + core.debug:print("scene", "inputs are currently locked") return core.input.fakekeys + else + return self.sources[sourceid].keys end end function Scene:flushKeys() core.input:flushKeys() self.sources = core.input:getSources() - self.inputLockedTimer = 1 + self.inputLockedTimer = 2 self.inputLocked = true end