It sounds like you have not spoken to a bankruptcy lawyer yet. Almost all offer free consultation. Please see one ASAP. They will tell you about your states homestead exemption. Every state has a different number. Basically it determines how much of your homes value you can keep in a bankruptcy.
Read this. Then call a lawyer...please
While you can keep profits from your home sale, buying another house in CH13 is complicated but it can be done.