mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
use an array of keycodes for multiple bindings of the same key
This commit is contained in:
@@ -51,18 +51,26 @@ function BindLink.constructor() --Allow multiple bindings of the same keys, no o
|
|||||||
return setmetatable(self, BindLink)
|
return setmetatable(self, BindLink)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BindLink:AddInputBegan(Key: Enum.KeyCode, Callback: CallbackFunction)
|
function BindLink:AddInputBegan(Keys: {Enum.KeyCode}, Callback: CallbackFunction)
|
||||||
if self.BindMap.Began[Key] then
|
for i = 1, #Keys do
|
||||||
warn(`Key >began< "{Key.Name}" is already binded on this KeyBind map`, debug.traceback())
|
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
|
||||||
self.BindMap.Began[Key] = Callback
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BindLink:AddInputEnded(Key: Enum.KeyCode, Callback: CallbackFunction)
|
function BindLink:AddInputEnded(Keys: {Enum.KeyCode}, Callback: CallbackFunction)
|
||||||
if self.BindMap.Ended[Key] then
|
for i = 1, #Keys do
|
||||||
warn(`Key >ended< "{Key.Name}" is already binded on this KeyBind map`, debug.traceback())
|
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
|
||||||
self.BindMap.Ended[Key] = Callback
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BindLink:KeyHold(Key: Enum.KeyCode): boolean
|
function BindLink:KeyHold(Key: Enum.KeyCode): boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user