def swap_gender(sim_info: SimInfo, update_gender_options: bool=True) -> bool: """swap_gender(sim_info, update_gender_options=True) Swap the Gender of a Sim to it's opposite. i.e. Change a Sim from Male to Female or from Female to Male. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param update_gender_options: If True, gender option traits such as Toilet Usage, Clothing Preference, Pregnancy, and Body Frame will be updated to reflect the vanilla settings for each gender\ For example, if a Human Sim is swapping from Female to Male, their gender options will be updated to Toilet Standing, Cannot Be Impregnated, Can Impregnate, Mens Wear clothing preference, and Masculine Frame.\ If False, gender option traits will not be updated.\ Default is True. :type update_gender_options: bool, optional :return: True, if the Gender of the Sim was swapped successfully. False, if not. :rtype: bool """ from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils if CommonGenderUtils.is_male(sim_info): result = CommonGenderUtils.set_gender(sim_info, Gender.FEMALE) if not update_gender_options: return result CommonSimGenderOptionUtils.update_gender_options_to_vanilla_female(sim_info) return result elif CommonGenderUtils.is_female(sim_info): result = CommonGenderUtils.set_gender(sim_info, Gender.MALE) if not update_gender_options: return result CommonSimGenderOptionUtils.update_gender_options_to_vanilla_male(sim_info) return result return False
def _set_to_vanilla_gender_chosen(): if CommonGenderUtils.is_male(self._sim_info): CommonSimGenderOptionUtils.update_gender_options_to_vanilla_male( self._sim_info) else: CommonSimGenderOptionUtils.update_gender_options_to_vanilla_female( self._sim_info) _reopen()
def _set_all_to_vanilla_gender_options_chosen(): for sim_info in CommonSimUtils.get_instanced_sim_info_for_all_sims_generator( ): if CommonGenderUtils.is_male(sim_info): CommonSimGenderOptionUtils.update_gender_options_to_vanilla_male( sim_info) else: CommonSimGenderOptionUtils.update_gender_options_to_vanilla_female( sim_info) _reopen()
def swap_gender(sim_info: SimInfo, update_gender_options: bool=True) -> bool: """swap_gender(sim_info, update_gender_options=True) Swap the Gender of a Sim to it's opposite. i.e. Change a Sim from Male to Female or from Female to Male. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param update_gender_options: If True, gender option traits such as Toilet Usage, Clothing Preference, Pregnancy, and Body Frame will be updated to reflect the vanilla settings for each gender\ For example, if a Human Sim is swapping from Female to Male, their gender options will be updated to Toilet Standing, Cannot Be Impregnated, Can Impregnate, Mens Wear clothing preference, and Masculine Frame.\ If False, gender option traits will not be updated.\ Default is True. :type update_gender_options: bool, optional :return: True, if the Gender of the Sim was swapped successfully. False, if not. :rtype: bool """ from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils result = False frame = CommonSimGenderOptionUtils.has_masculine_frame(sim_info) prefers_menswear = CommonSimGenderOptionUtils.prefers_menswear(sim_info) can_impregnate = CommonSimGenderOptionUtils.can_impregnate(sim_info) can_be_impregnated = CommonSimGenderOptionUtils.can_be_impregnated(sim_info) can_reproduce = CommonSimGenderOptionUtils.can_reproduce(sim_info) uses_toilet_standing = CommonSimGenderOptionUtils.uses_toilet_standing(sim_info) has_breasts = CommonSimGenderOptionUtils.has_breasts(sim_info) saved_outfits = sim_info.save_outfits() current_outfit = CommonOutfitUtils.get_current_outfit(sim_info) if CommonGenderUtils.is_male(sim_info): result = CommonGenderUtils.set_gender(sim_info, Gender.FEMALE) if update_gender_options: CommonSimGenderOptionUtils.update_gender_options_to_vanilla_female(sim_info) elif CommonGenderUtils.is_female(sim_info): result = CommonGenderUtils.set_gender(sim_info, Gender.MALE) if update_gender_options: CommonSimGenderOptionUtils.update_gender_options_to_vanilla_male(sim_info) if not update_gender_options: CommonSimGenderOptionUtils.update_body_frame(sim_info, frame) CommonSimGenderOptionUtils.update_clothing_preference(sim_info, prefers_menswear) CommonSimGenderOptionUtils.update_can_impregnate(sim_info, can_impregnate) CommonSimGenderOptionUtils.update_can_be_impregnated(sim_info, can_be_impregnated) CommonSimGenderOptionUtils.update_can_reproduce(sim_info, can_reproduce) CommonSimGenderOptionUtils.update_toilet_usage(sim_info, uses_toilet_standing) CommonSimGenderOptionUtils.update_has_breasts(sim_info, has_breasts) sim_info.load_outfits(saved_outfits) CommonOutfitUtils.resend_outfits(sim_info) CommonOutfitUtils.set_current_outfit(sim_info, current_outfit) return result