use an array of keycodes for multiple bindings of the same key

This commit is contained in:
2023-12-27 14:12:10 -05:00
parent ecbbc5971a
commit e55b8763f3

View File

@@ -51,18 +51,26 @@ function BindLink.constructor() --Allow multiple bindings of the same keys, no o
return setmetatable(self, BindLink)
end
function BindLink:AddInputBegan(Key: Enum.KeyCode, Callback: CallbackFunction)
function BindLink:AddInputBegan(Keys: {Enum.KeyCode}, Callback: CallbackFunction)
for i = 1, #Keys do
local Key = Keys[i]
if self.BindMap.Began[Key] then
warn(`Key >began< "{Key.Name}" is already binded on this KeyBind map`, debug.traceback())
end
self.BindMap.Began[Key] = Callback
end
end
function BindLink:AddInputEnded(Key: Enum.KeyCode, Callback: CallbackFunction)
function BindLink:AddInputEnded(Keys: {Enum.KeyCode}, Callback: CallbackFunction)
for i = 1, #Keys do
local Key = Keys[i]
if self.BindMap.Ended[Key] then
warn(`Key >ended< "{Key.Name}" is already binded on this KeyBind map`, debug.traceback())
end
self.BindMap.Ended[Key] = Callback
end
end
function BindLink:KeyHold(Key: Enum.KeyCode): boolean