function ControlModule.GetMoveVector(y)if y.activeController then return y.activeController:GetMoveVector()end return Vector3.new(0,0,0)end function ControlModule.GetActiveController(y)return y.activeController end function ControlModule.Enable(C,y)if not C.activeController then return end if y==nil then y=true end if y then if C.touchControlFrame then C.activeController:Enable(true,C.touchControlFrame)else if C.activeControlModule==ClickToMove then C.activeController:Enable(true,Players.LocalPlayer.DevComputerMovementMode==Enum.DevComputerMovementMode.UserChoice)else C.activeController:Enable(true)end end else C: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:Enable(enable)
	if not self.activeController then
		return
	end

	if enable == nil then
		enable = true
	end
	if enable then
		if self.touchControlFrame then
			self.activeController:Enable(true, self.touchControlFrame)
		else
			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 spacebar to jump.
				self.activeController:Enable(
					true,
					Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice
				)
			else
				self.activeController:Enable(true)
			end
		end
	else
		self:Disable()
	end
end
