--- Installs listener for targeting mode toggling hotkeys.
-- @returns void

function TargetingModule:BindTargetingModeHotkeys()
	local function Callback(Action, State, Input)
		if (State.Name == 'End') then
			return Enum.ContextActionResult.Pass
		end

		-- Ensure shift is held
		local KeysPressed = UserInputService:GetKeysPressed()
		local IsShiftHeld = Input:IsModifierKeyDown(Enum.ModifierKey.Shift)
		if (#KeysPressed ~= 2) or (not IsShiftHeld) then
			return Enum.ContextActionResult.Pass
		end

		-- Toggle between targeting modes
		self:ToggleTargetingMode()
		self:UpdateTarget(nil, true)

		-- Sink input
		return Enum.ContextActionResult.Sink
	end

	-- Install listener for T key
	ContextActionService:BindAction('BT: Toggle Targeting Mode', Callback, false, Enum.KeyCode.T)

	-- Unbind hotkey when tool is disabled
	local Core = GetCore()
	Core.Connections.UnbindTargetingModeHotkeys = Core.Disabling:Connect(function ()
		ContextActionService:UnbindAction('BT: Toggle Targeting Mode')
	end)
end

function GetCore()
	return require(script.Parent);
end;

return TargetingModule;
