function ControlModule.GetMoveVector(k)if k.activeController then return k.activeController:GetMoveVector()end return Vector3.new(0,0,0)end function ControlModule.GetActiveController(k)return k.activeController end function ControlModule.EnableActiveControlModule(k)if k.activeControlModule==ClickToMove then k.activeController:Enable(true,Players.LocalPlayer.DevComputerMovementMode==Enum.DevComputerMovementMode.UserChoice,k.touchJumpController)elseif k.touchControlFrame then k.activeController:Enable(true,k.touchControlFrame)else k.activeController:Enable(true)end end function ControlModule.Enable(K,k)if not K.activeController then return end if k==nil then k=true end if k then K:EnableActiveControlModule()else K:Disable()end end
-- Convenience function so that calling code does not have to first get the activeController
-- and then call GetMoveVector on it. When there is no active controller, this function returns
-- nil so that this case can be distinguished from no current movement (which returns zero vector).
function ControlModule:GetMoveVector()
	if self.activeController then
		return self.activeController:GetMoveVector()
	end
	return Vector3.new(0, 0, 0)
end

function ControlModule:GetActiveController()
	return self.activeController
end

function ControlModule:EnableActiveControlModule()
	if self.activeControlModule == ClickToMove then
		-- For ClickToMove, when it is the player's choice, we also enable the full keyboard controls.
		-- When the developer is forcing click to move, the most keyboard controls (WASD) are not available, only jump.
		self.activeController:Enable(
			true,
			Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice,
			self.touchJumpController
		)
	elseif self.touchControlFrame then
		self.activeController:Enable(true, self.touchControlFrame)
	else
		self.activeController:Enable(true)
	end
end

function ControlModule:Enable(enable)
	if not self.activeController then
		return
	end

	if enable == nil then
		enable = true
	end
	if enable then
		self:EnableActiveControlModule()
	else
		self:Disable()
	end
end
