Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 def _can_be_impregnated_chosen(option_identifier: str,
                                can_get_pregnant: bool):
     self.log.format(option_identifier=option_identifier,
                     can_get_pregnant=can_get_pregnant)
     value = not CommonSimGenderOptionUtils.can_be_impregnated(
         self._sim_info)
     CommonSimGenderOptionUtils.update_can_be_impregnated(
         self._sim_info, value)
     _reopen()
Exemplo n.º 4
0
 def _on_chosen(_: str, picked_option: bool):
     if picked_option is None:
         _on_close()
         return
     value = not CommonSimGenderOptionUtils.can_reproduce(
         self._sim_info)
     CommonSimGenderOptionUtils.update_can_reproduce(
         self._sim_info, value)
     _reopen()
Exemplo n.º 5
0
 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()
Exemplo n.º 6
0
    def _pregnancy_options(self, on_close: Callable[[], Any] = None) -> None:
        def _on_close():
            if on_close is not None:
                on_close()

        def _reopen():
            self._pregnancy_options(on_close=on_close)

        option_dialog = CommonChooseObjectOptionDialog(
            CGSStringId.CGS_PREGNANCY_OPTIONS_NAME,
            CGSStringId.CGS_PREGNANCY_OPTIONS_DESCRIPTION,
            mod_identity=self.mod_identity,
            on_close=_on_close)

        def _can_impregnate_chosen(option_identifier: str,
                                   can_get_others_pregnant: bool):
            self.log.format(option_identifier=option_identifier,
                            can_get_others_pregnant=can_get_others_pregnant)
            value = not CommonSimGenderOptionUtils.can_impregnate(
                self._sim_info)
            CommonSimGenderOptionUtils.update_can_impregnate(
                self._sim_info, value)
            _reopen()

        option_dialog.add_option(
            CommonDialogToggleOption(
                'CanImpregnate',
                CommonSimGenderOptionUtils.can_impregnate(self._sim_info),
                CommonDialogOptionContext(
                    CGSStringId.CGS_CAN_GET_OTHERS_PREGNANT_NAME,
                    CGSStringId.CGS_CAN_GET_OTHERS_PREGNANT_DESCRIPTION),
                on_chosen=_can_impregnate_chosen))

        def _can_be_impregnated_chosen(option_identifier: str,
                                       can_get_pregnant: bool):
            self.log.format(option_identifier=option_identifier,
                            can_get_pregnant=can_get_pregnant)
            value = not CommonSimGenderOptionUtils.can_be_impregnated(
                self._sim_info)
            CommonSimGenderOptionUtils.update_can_be_impregnated(
                self._sim_info, value)
            _reopen()

        option_dialog.add_option(
            CommonDialogToggleOption(
                'CanBeImpregnated',
                CommonSimGenderOptionUtils.can_be_impregnated(self._sim_info),
                CommonDialogOptionContext(
                    CGSStringId.CGS_CAN_BECOME_PREGNANT_NAME,
                    CGSStringId.CGS_CAN_BECOME_PREGNANT_DESCRIPTION),
                on_chosen=_can_be_impregnated_chosen))

        option_dialog.show(sim_info=self._sim_info)
Exemplo n.º 7
0
        def _on_toggle_breasts_chosen(option_identifier: str,
                                      has_breasts: bool):
            self.log.format(option_identifier=option_identifier,
                            has_breasts=has_breasts)

            def _on_acknowledged(_):
                _reopen()

            CommonSimGenderOptionUtils.update_has_breasts(
                self._sim_info, has_breasts)
            CommonOkDialog(
                CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_NAME,
                CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_DESCRIPTION).show(
                    on_acknowledged=_on_acknowledged)
    def uses_toilet_sitting(sim_info: SimInfo) -> bool:
        """uses_toilet_sitting(sim_info)

        Determine if a sim uses the toilet while sitting.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim uses toilets while sitting. False, if the Sim does not use toilets while sitting.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.uses_toilet_sitting(sim_info)
    def has_feminine_frame(sim_info: SimInfo) -> bool:
        """has_feminine_frame(sim_info)

        Determine if a sim has a Feminine Body Frame.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim does. False, if the Sim does not.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.has_feminine_frame(sim_info)
    def prefers_womenswear(sim_info: SimInfo) -> bool:
        """prefers_womenswear(sim_info)

        Determine if a sim prefers Womens Clothing.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim does. False, if the Sim does not.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.prefers_womenswear(sim_info)
Exemplo n.º 11
0
    def get_body_frame(sim_info: SimInfo) -> 'CommonBodyFrame':
        """get_body_frame(sim_info)

        Retrieve the CommonBodyFrame of a sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :return: The body frame of the Sim or CommonBodyFrame.INVALID if their current body frame cannot be determined.
        :rtype: CommonBodyFrame
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        if CommonSpeciesUtils.is_pet(sim_info):
            if CommonGenderUtils.is_male(sim_info):
                return CommonBodyFrame.MASCULINE
            if CommonGenderUtils.is_female(sim_info):
                return CommonBodyFrame.FEMININE
            return CommonBodyFrame.INVALID

        if CommonSimGenderOptionUtils.has_masculine_frame(sim_info):
            return CommonBodyFrame.MASCULINE
        if CommonSimGenderOptionUtils.has_feminine_frame(sim_info):
            return CommonBodyFrame.FEMININE
        return CommonBodyFrame.INVALID
    def can_not_reproduce(sim_info: SimInfo) -> bool:
        """can_not_reproduce(sim_info)

        Determine if a pet sim can reproduce.

        ..note:: Use :func:`~can_not_impregnate` and :func:`~can_not_be_impregnated` for Human Sims.
        .. note:: Will return False if the pet sim has the PREGNANCY_OPTIONS_PET_CAN_REPRODUCE trait.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim can not reproduce. False, if the Sim can reproduce.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.can_not_reproduce(sim_info)
    def can_not_be_impregnated(sim_info: SimInfo) -> bool:
        """can_not_be_impregnated(sim_info)

        Determine if a sim Can Not Be Impregnated.

        .. note:: Use :func:`~can_not_reproduce` for Pet Sims.
        .. note:: Will return False if the sim has the GENDER_OPTIONS_PREGNANCY_CAN_BE_IMPREGNATED trait.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim can not be impregnated. False, if the Sim can be impregnated.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.can_not_be_impregnated(sim_info)
    def can_not_impregnate(sim_info: SimInfo) -> bool:
        """can_not_impregnate(sim_info)

        Determine if a sim Can Not Impregnate.

        .. note:: Use :func:`~can_not_reproduce` for Pet Sims.
        .. note:: This will check for a sim to not also have the GENDER_OPTIONS_PREGNANCY_CAN_IMPREGNATE trait.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim can not impregnate other Sims. False, if the Sim can impregnate other Sims.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.can_not_impregnate(sim_info)
    def can_create_pregnancy(sim_info: SimInfo) -> bool:
        """can_create_pregnancy(sim_info)

        Determine if a Sim can either impregnate, be impregnated, or can reproduce.

        .. note:: Will return False if the Sim can both impregnate and not impregnate,\
            if the Sim can both be impregnated and not be impregnated\
            or if the Sim can both reproduce and not reproduce.

        .. note:: A Sim can impregnate when they can either impregnate other Sims, can be impregnated by other Sims, or if they are a Pet, can reproduce.

        :param sim_info: The Sim to check.
        :type sim_info: SimInfo
        :return: True, if the Sim can create pregnancies. False, if the Sim can not create pregnancies.
        :rtype: bool
        """
        from sims4communitylib.utils.sims.common_sim_gender_option_utils import CommonSimGenderOptionUtils
        return CommonSimGenderOptionUtils.can_create_pregnancy(sim_info)
Exemplo n.º 16
0
    def _settings_pet(self, on_close: Callable[[], Any] = None) -> None:
        def _reopen() -> None:
            self._settings_pet(on_close=on_close)

        def _on_close(*_, **__) -> None:
            if on_close is not None:
                on_close()

        def _on_chosen(_: str, picked_option: bool):
            if picked_option is None:
                _on_close()
                return
            value = not CommonSimGenderOptionUtils.can_reproduce(
                self._sim_info)
            CommonSimGenderOptionUtils.update_can_reproduce(
                self._sim_info, value)
            _reopen()

        option_dialog = CommonChooseObjectOptionDialog(
            CommonStringId.CUSTOM_GENDER_SETTINGS,
            CGSStringId.CGS_CUSTOM_GENDER_SETTINGS_DESCRIPTION,
            mod_identity=self.mod_identity,
            on_close=_on_close)

        current_selected = CGSStringId.NATURAL
        can_reproduce = CommonSimGenderOptionUtils.can_reproduce(
            self._sim_info)
        if not can_reproduce:
            current_selected = CGSStringId.FIXED

        option_dialog.add_option(
            CommonDialogToggleOption(
                'Reproductive Settings',
                can_reproduce,
                CommonDialogOptionContext(
                    CGSStringId.REPRODUCTIVE_SETTINGS,
                    CGSStringId.CGS_CURRENT,
                    description_tokens=(current_selected, ),
                    icon=CommonIconUtils.load_question_mark_icon()),
                on_chosen=_on_chosen))

        option_dialog.show(sim_info=self._sim_info)
Exemplo n.º 17
0
    def _settings_human(self, on_close: Callable[[], Any] = None) -> None:
        def _on_close() -> None:
            if on_close is not None:
                on_close()

        def _reopen():
            self._settings_human(on_close=on_close)

        option_dialog = CommonChooseObjectOptionDialog(
            CommonStringId.CUSTOM_GENDER_SETTINGS,
            CGSStringId.CGS_CUSTOM_GENDER_SETTINGS_DESCRIPTION,
            mod_identity=self.mod_identity,
            on_close=_on_close)

        option_dialog.add_option(
            CommonDialogActionOption(
                CommonDialogOptionContext(
                    CGSStringId.GLOBAL_SETTINGS_NAME,
                    CGSStringId.GLOBAL_SETTINGS_DESCRIPTION),
                on_chosen=CGSGlobalSettingsDialog(self._sim_info,
                                                  on_close=_reopen).open))

        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()

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(
                CGSStringId.CGS_SET_TO_VANILLA_GENDER_OPTIONS_NAME,
                CGSStringId.CGS_SET_TO_VANILLA_GENDER_OPTIONS_DESCRIPTION,
                icon=CommonIconUtils.load_arrow_right_icon()),
                                     on_chosen=_set_to_vanilla_gender_chosen))

        def _on_gender_chosen():
            CommonGenderUtils.swap_gender(self._sim_info,
                                          update_gender_options=False)
            _reopen()

        current_gender_string = CGSStringId.MALE
        if CommonGenderUtils.is_female(self._sim_info):
            current_gender_string = CGSStringId.FEMALE

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(
                CGSStringId.CGS_SWAP_GENDER_NAME,
                CGSStringId.CGS_SWAP_GENDER_DESCRIPTION,
                title_tokens=(current_gender_string, ),
                icon=CommonIconUtils.load_arrow_right_icon()),
                                     on_chosen=_on_gender_chosen))

        def _on_physical_frame_chosen():
            value = not CommonSimGenderOptionUtils.has_masculine_frame(
                self._sim_info)
            CommonSimGenderOptionUtils.update_body_frame(self._sim_info, value)
            _reopen()

        current_body_frame = CommonStringId.FEMININE
        if CommonSimGenderOptionUtils.has_masculine_frame(self._sim_info):
            current_body_frame = CommonStringId.MASCULINE

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(
                CommonStringId.PHYSICAL_FRAME,
                CGSStringId.CGS_CURRENT,
                description_tokens=(current_body_frame, ),
                icon=CommonIconUtils.load_arrow_right_icon()),
                                     on_chosen=_on_physical_frame_chosen))

        current_clothing = CommonStringId.FEMININE
        if CommonSimGenderOptionUtils.prefers_menswear(self._sim_info):
            current_clothing = CommonStringId.MASCULINE

        def _on_clothing_preference_chosen():
            value = not CommonSimGenderOptionUtils.prefers_menswear(
                self._sim_info)
            CommonSimGenderOptionUtils.update_clothing_preference(
                self._sim_info, value)
            _reopen()

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(
                CommonStringId.CLOTHING_PREFERENCE,
                CGSStringId.CGS_CURRENT,
                description_tokens=(current_clothing, ),
                icon=CommonIconUtils.load_arrow_right_icon()),
                                     on_chosen=_on_clothing_preference_chosen))

        def _on_toggle_breasts_chosen(option_identifier: str,
                                      has_breasts: bool):
            self.log.format(option_identifier=option_identifier,
                            has_breasts=has_breasts)

            def _on_acknowledged(_):
                _reopen()

            CommonSimGenderOptionUtils.update_has_breasts(
                self._sim_info, has_breasts)
            CommonOkDialog(
                CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_NAME,
                CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_DESCRIPTION).show(
                    on_acknowledged=_on_acknowledged)

        has_vanilla_breasts = False
        if CommonGenderUtils.is_female(self._sim_info):
            has_vanilla_breasts = not CommonTraitUtils.has_trait(
                self._sim_info, CommonTraitId.BREASTS_FORCE_OFF)

        option_dialog.add_option(
            CommonDialogToggleOption(
                'ToggleBreasts',
                CommonTraitUtils.has_trait(self._sim_info,
                                           CommonTraitId.BREASTS_FORCE_ON)
                or has_vanilla_breasts,
                CommonDialogOptionContext(
                    CGSStringId.CGS_TOGGLE_BREASTS_NAME,
                    CGSStringId.CGS_TOGGLE_BREASTS_DESCRIPTION),
                on_chosen=_on_toggle_breasts_chosen))

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(
                CGSStringId.CGS_PREGNANCY_OPTIONS_NAME,
                CGSStringId.CGS_PREGNANCY_OPTIONS_DESCRIPTION,
                icon=CommonIconUtils.load_arrow_navigate_into_icon()),
                                     on_chosen=lambda *_, **__: self.
                                     _pregnancy_options(on_close=_reopen)))

        title = CGSStringId.CGS_TOGGLE_CAN_USE_TOILET_STANDING_NAME
        if CommonSimGenderOptionUtils.uses_toilet_standing(self._sim_info):
            title = CommonLocalizationUtils.create_localized_string(
                title, text_color=CommonLocalizedStringColor.GREEN)
            icon = CommonIconUtils.load_checked_square_icon()
        else:
            icon = CommonIconUtils.load_unchecked_square_icon()
        text = CGSStringId.CGS_TOGGLE_CAN_USE_TOILET_STANDING_DESCRIPTION

        def _on_toilet_usage_chosen():
            value = not CommonSimGenderOptionUtils.uses_toilet_standing(
                self._sim_info)
            CommonSimGenderOptionUtils.update_toilet_usage(
                self._sim_info, value)
            _reopen()

        option_dialog.add_option(
            CommonDialogActionOption(CommonDialogOptionContext(title,
                                                               text,
                                                               icon=icon),
                                     on_chosen=_on_toilet_usage_chosen))

        option_dialog.show(sim_info=self._sim_info)
Exemplo n.º 18
0
 def _update_gender_options(self, sim_info: SimInfo):
     update_outfits = False
     if self._setting_utils.force_all_sims_to_male(
     ) and not CommonGenderUtils.is_male(sim_info):
         CommonGenderUtils.swap_gender(sim_info,
                                       update_gender_options=False)
         update_outfits = True
     elif self._setting_utils.force_all_sims_to_female(
     ) and not CommonGenderUtils.is_female(sim_info):
         CommonGenderUtils.swap_gender(sim_info,
                                       update_gender_options=False)
         update_outfits = True
     if CommonGenderUtils.is_male(sim_info):
         if CommonSpeciesUtils.is_pet(sim_info):
             if self._setting_utils.all_male_options.can_reproduce(
             ) and not CommonSimGenderOptionUtils.can_reproduce(sim_info):
                 CommonSimGenderOptionUtils.update_can_reproduce(
                     sim_info, True)
             if self._setting_utils.all_male_options.cannot_reproduce(
             ) and not CommonSimGenderOptionUtils.can_not_reproduce(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_reproduce(
                     sim_info, False)
         elif CommonSpeciesUtils.is_human(sim_info):
             if self._setting_utils.all_male_options.use_toilet_standing(
             ) and not CommonSimGenderOptionUtils.uses_toilet_standing(
                     sim_info):
                 CommonSimGenderOptionUtils.update_toilet_usage(
                     sim_info, True)
                 update_outfits = True
             if self._setting_utils.all_male_options.use_toilet_sitting(
             ) and not CommonSimGenderOptionUtils.uses_toilet_sitting(
                     sim_info):
                 CommonSimGenderOptionUtils.update_toilet_usage(
                     sim_info, False)
                 update_outfits = True
             if self._setting_utils.all_male_options.prefer_menswear(
             ) and not CommonSimGenderOptionUtils.prefers_menswear(
                     sim_info):
                 CommonSimGenderOptionUtils.update_clothing_preference(
                     sim_info, True)
             if self._setting_utils.all_male_options.prefer_womenswear(
             ) and not CommonSimGenderOptionUtils.prefers_womenswear(
                     sim_info):
                 CommonSimGenderOptionUtils.update_clothing_preference(
                     sim_info, False)
             if self._setting_utils.all_male_options.force_masculine_body_frame(
             ) and not CommonSimGenderOptionUtils.has_masculine_frame(
                     sim_info):
                 CommonSimGenderOptionUtils.update_body_frame(
                     sim_info, True)
             if self._setting_utils.all_male_options.force_feminine_body_frame(
             ) and not CommonSimGenderOptionUtils.has_feminine_frame(
                     sim_info):
                 CommonSimGenderOptionUtils.update_body_frame(
                     sim_info, False)
             if self._setting_utils.all_male_options.can_impregnate(
             ) and not CommonSimGenderOptionUtils.can_impregnate(sim_info):
                 CommonSimGenderOptionUtils.update_can_impregnate(
                     sim_info, True)
             if self._setting_utils.all_male_options.cannot_impregnate(
             ) and not CommonSimGenderOptionUtils.can_not_impregnate(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_impregnate(
                     sim_info, False)
             if self._setting_utils.all_male_options.can_be_impregnated(
             ) and not CommonSimGenderOptionUtils.can_be_impregnated(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_be_impregnated(
                     sim_info, True)
             if self._setting_utils.all_male_options.cannot_be_impregnated(
             ) and not CommonSimGenderOptionUtils.can_not_be_impregnated(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_be_impregnated(
                     sim_info, False)
             if self._setting_utils.all_male_options.force_breasts_on(
             ) and not CommonSimGenderOptionUtils.has_breasts(sim_info):
                 CommonSimGenderOptionUtils.update_has_breasts(
                     sim_info, True)
                 update_outfits = True
             if self._setting_utils.all_male_options.force_breasts_off(
             ) and CommonSimGenderOptionUtils.has_breasts(sim_info):
                 CommonSimGenderOptionUtils.update_has_breasts(
                     sim_info, False)
                 update_outfits = True
     elif CommonGenderUtils.is_female(sim_info):
         if CommonSpeciesUtils.is_pet(sim_info):
             if self._setting_utils.all_female_options.can_reproduce(
             ) and not CommonSimGenderOptionUtils.can_reproduce(sim_info):
                 CommonSimGenderOptionUtils.update_can_reproduce(
                     sim_info, True)
             if self._setting_utils.all_female_options.cannot_reproduce(
             ) and not CommonSimGenderOptionUtils.can_not_reproduce(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_reproduce(
                     sim_info, False)
         elif CommonSpeciesUtils.is_human(sim_info):
             if self._setting_utils.all_female_options.use_toilet_standing(
             ) and not CommonSimGenderOptionUtils.uses_toilet_standing(
                     sim_info):
                 CommonSimGenderOptionUtils.update_toilet_usage(
                     sim_info, True)
                 update_outfits = True
             if self._setting_utils.all_female_options.use_toilet_sitting(
             ) and not CommonSimGenderOptionUtils.uses_toilet_sitting(
                     sim_info):
                 CommonSimGenderOptionUtils.update_toilet_usage(
                     sim_info, False)
                 update_outfits = True
             if self._setting_utils.all_female_options.prefer_menswear(
             ) and not CommonSimGenderOptionUtils.prefers_menswear(
                     sim_info):
                 CommonSimGenderOptionUtils.update_clothing_preference(
                     sim_info, True)
             if self._setting_utils.all_female_options.prefer_womenswear(
             ) and not CommonSimGenderOptionUtils.prefers_womenswear(
                     sim_info):
                 CommonSimGenderOptionUtils.update_clothing_preference(
                     sim_info, False)
             if self._setting_utils.all_female_options.force_masculine_body_frame(
             ) and not CommonSimGenderOptionUtils.has_masculine_frame(
                     sim_info):
                 CommonSimGenderOptionUtils.update_body_frame(
                     sim_info, True)
             if self._setting_utils.all_female_options.force_feminine_body_frame(
             ) and not CommonSimGenderOptionUtils.has_feminine_frame(
                     sim_info):
                 CommonSimGenderOptionUtils.update_body_frame(
                     sim_info, False)
             if self._setting_utils.all_female_options.can_impregnate(
             ) and not CommonSimGenderOptionUtils.can_impregnate(sim_info):
                 CommonSimGenderOptionUtils.update_can_impregnate(
                     sim_info, True)
             if self._setting_utils.all_female_options.cannot_impregnate(
             ) and not CommonSimGenderOptionUtils.can_not_impregnate(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_impregnate(
                     sim_info, False)
             if self._setting_utils.all_female_options.can_be_impregnated(
             ) and not CommonSimGenderOptionUtils.can_be_impregnated(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_be_impregnated(
                     sim_info, True)
             if self._setting_utils.all_female_options.cannot_be_impregnated(
             ) and not CommonSimGenderOptionUtils.can_not_be_impregnated(
                     sim_info):
                 CommonSimGenderOptionUtils.update_can_be_impregnated(
                     sim_info, False)
             if self._setting_utils.all_female_options.force_breasts_on(
             ) and not CommonSimGenderOptionUtils.has_breasts(sim_info):
                 CommonSimGenderOptionUtils.update_has_breasts(
                     sim_info, True)
                 update_outfits = True
             if self._setting_utils.all_female_options.force_breasts_off(
             ) and CommonSimGenderOptionUtils.has_breasts(sim_info):
                 CommonSimGenderOptionUtils.update_has_breasts(
                     sim_info, False)
                 update_outfits = True
     if update_outfits:
         CommonOutfitUtils.update_outfits(sim_info)
    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
Exemplo n.º 20
0
 def _on_physical_frame_chosen():
     value = not CommonSimGenderOptionUtils.has_masculine_frame(
         self._sim_info)
     CommonSimGenderOptionUtils.update_body_frame(self._sim_info, value)
     _reopen()
Exemplo n.º 21
0
 def _on_clothing_preference_chosen():
     value = not CommonSimGenderOptionUtils.prefers_menswear(
         self._sim_info)
     CommonSimGenderOptionUtils.update_clothing_preference(
         self._sim_info, value)
     _reopen()
Exemplo n.º 22
0
 def _on_toilet_usage_chosen():
     value = not CommonSimGenderOptionUtils.uses_toilet_standing(
         self._sim_info)
     CommonSimGenderOptionUtils.update_toilet_usage(
         self._sim_info, value)
     _reopen()