def update_can_reproduce(sim_info: SimInfo, can_reproduce: bool) -> bool: """update_can_reproduce(sim_info, can_reproduce) Update a Sims ability to reproduce. .. note:: Will only update Pet Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param can_reproduce: If True, the Sim will have the ability to reproduce.\ If False, the Sim will not have the ability to reproduce. :type can_reproduce: bool :return: True, if successful. False, if not. :rtype: bool """ if sim_info is None: return False if not CommonSpeciesUtils.is_pet(sim_info): return False if can_reproduce: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.PREGNANCY_OPTIONS_PET_CAN_NOT_REPRODUCE) CommonTraitUtils.add_trait( sim_info, CommonTraitId.PREGNANCY_OPTIONS_PET_CAN_REPRODUCE) else: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.PREGNANCY_OPTIONS_PET_CAN_REPRODUCE) CommonTraitUtils.add_trait( sim_info, CommonTraitId.PREGNANCY_OPTIONS_PET_CAN_NOT_REPRODUCE) from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonSimEventDispatcherService( )._on_sim_change_gender_options_can_reproduce(sim_info) return True
def update_toilet_usage(sim_info: SimInfo, uses_toilet_standing: bool) -> bool: """update_toilet_usage(sim_info, uses_toilet_standing) Update how a Sim uses the toilet. i.e. Toilet Standing or Toilet Sitting. .. note:: Will only update Human Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param uses_toilet_standing: If True, the Sim will use toilets while standing.\ If False, the Sim will use toilets while sitting. :type uses_toilet_standing: bool :return: True, if successful. False, if not. :rtype: bool """ if sim_info is None: return False if not CommonSpeciesUtils.is_human(sim_info): return False if uses_toilet_standing: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_TOILET_SITTING) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_TOILET_STANDING) else: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_TOILET_STANDING) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_TOILET_SITTING) from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonSimEventDispatcherService( )._on_sim_change_gender_options_toilet_usage(sim_info) return True
def update_clothing_preference(sim_info: SimInfo, prefer_menswear: bool) -> bool: """update_clothing_preference(sim_info, prefer_menswear) Update the Clothing Preference of a Sim. .. note:: Will only update Human Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param prefer_menswear: If True, the Sim will prefer Menswear.\ If False, the Sim will prefer Womenswear. :type prefer_menswear: bool :return: True, if successful. False, if not. :rtype: bool """ if sim_info is None: return False if not CommonSpeciesUtils.is_human(sim_info): return False if prefer_menswear: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_CLOTHING_WOMENS_WEAR) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_CLOTHING_MENS_WEAR) else: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_CLOTHING_MENS_WEAR) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_CLOTHING_WOMENS_WEAR) from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonSimEventDispatcherService( )._on_sim_change_gender_options_clothing_preference(sim_info) return True
def update_body_frame(sim_info: SimInfo, masculine: bool) -> bool: """update_body_frame(sim_info, masculine) Update the Body Frame of a Sim. .. note:: Will only update Human Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param masculine: If True, the Sim will get a Masculine frame.\ If False, the Sim will get a Feminine frame. :type masculine: bool :return: True, if successful. False, if not. :rtype: bool """ if sim_info is None: return False if not CommonSpeciesUtils.is_human(sim_info): return False if masculine: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_FRAME_FEMININE) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_FRAME_MASCULINE) else: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_FRAME_MASCULINE) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_FRAME_FEMININE) from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonSimEventDispatcherService( )._on_sim_change_gender_options_body_frame(sim_info) return True
def _try_apply_traits(self, sim_info: SimInfo): if CommonSpeciesUtils.is_human(sim_info): CommonTraitUtils.remove_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM) if CommonTraitUtils.has_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM): return CommonTraitUtils.add_trait(sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM) elif CommonSpeciesUtils.is_large_dog(sim_info): CommonTraitUtils.remove_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM) if CommonTraitUtils.has_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM): return CommonTraitUtils.add_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM) elif CommonSpeciesUtils.is_small_dog(sim_info): CommonTraitUtils.remove_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM) if CommonTraitUtils.has_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM): return CommonTraitUtils.add_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM) elif CommonSpeciesUtils.is_cat(sim_info): CommonTraitUtils.remove_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM) if CommonTraitUtils.has_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM): return CommonTraitUtils.add_trait(sim_info, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM) elif CommonSpeciesUtils.is_fox(sim_info): CommonTraitUtils.remove_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_HUMAN_SIM, S4CMTraitId.S4CM_CONTROLLABLE_LARGE_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_SMALL_DOG_SIM, S4CMTraitId.S4CM_CONTROLLABLE_CAT_SIM) if CommonTraitUtils.has_trait( sim_info, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM): return CommonTraitUtils.add_trait(sim_info, S4CMTraitId.S4CM_CONTROLLABLE_FOX_SIM)
def _on_submit(chosen_traits: Tuple[Trait]): trait_tracker: TraitTracker = sim_info.trait_tracker for personality_trait in trait_tracker.personality_traits: CommonTraitUtils.remove_trait(sim_info, personality_trait) for chosen_trait in chosen_traits: CommonTraitUtils.add_trait(sim_info, chosen_trait) # noinspection PyUnresolvedReferences CommonBasicNotification( S4CMSimControlMenuStringId.SET_PERSONALITY_TRAITS_TITLE, S4CMSimControlMenuStringId.SET_PERSONALITY_TRAITS_DESCRIPTION, description_tokens=( CommonSimUtils.get_sim_instance(sim_info), )).show(icon=IconInfoData( obj_instance=CommonSimUtils.get_sim_instance(sim_info))) _reopen()
def run( self, sim_info: SimInfo, on_completed: Callable[[bool], None] = CommonFunctionUtils.noop) -> bool: if not CommonOccultUtils.is_robot(sim_info): on_completed(False) return False # trait_Humanoid_Robots_MainTrait trait_id = CommonTraitId.OCCULT_ROBOT result = CommonTraitUtils.remove_trait(sim_info, trait_id) on_completed(result) return result
def update_can_be_impregnated(sim_info: SimInfo, can_be_impregnated: bool) -> bool: """update_can_be_impregnated(sim_info, can_be_impregnated) Update a Sims ability to be impregnated by other Sims. .. note:: Will only update Human Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param can_be_impregnated: If True, the Sim will have the ability to be impregnated.\ If False, the Sim will not have the ability to be impregnated. :type can_be_impregnated: bool :return: True, if successful. False, if not. :rtype: bool """ if sim_info is None: return False if not CommonSpeciesUtils.is_human(sim_info): return False if can_be_impregnated: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_PREGNANCY_CAN_NOT_BE_IMPREGNATED) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_PREGNANCY_CAN_BE_IMPREGNATED) else: CommonTraitUtils.remove_trait( sim_info, CommonTraitId.GENDER_OPTIONS_PREGNANCY_CAN_BE_IMPREGNATED) CommonTraitUtils.add_trait( sim_info, CommonTraitId.GENDER_OPTIONS_PREGNANCY_CAN_NOT_BE_IMPREGNATED) from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonSimEventDispatcherService( )._on_sim_change_gender_options_can_be_impregnated(sim_info) return True
def update_has_breasts(sim_info: SimInfo, has_breasts: bool) -> bool: """update_has_breasts(sim_info, has_breasts) Give or Take Away the breasts of a Sim. .. note:: Will only update Human Sims. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :param has_breasts: If True, the Sim will be given breasts.\ If False, the Sim will not longer have breasts. :type has_breasts: bool :return: True, if the state of a Sim having breasts or not was changed. False, if not. :rtype: bool """ if sim_info is None: return False from sims4communitylib.events.sim.common_sim_event_dispatcher import CommonSimEventDispatcherService CommonTraitUtils.remove_trait(sim_info, CommonTraitId.BREASTS_FORCE_OFF) CommonTraitUtils.remove_trait(sim_info, CommonTraitId.BREASTS_FORCE_ON) if has_breasts: if CommonGenderUtils.is_male(sim_info): CommonTraitUtils.add_trait(sim_info, CommonTraitId.BREASTS_FORCE_ON) CommonSimEventDispatcherService( )._on_sim_change_gender_options_breasts(sim_info) return True else: if CommonGenderUtils.is_female(sim_info): CommonTraitUtils.add_trait(sim_info, CommonTraitId.BREASTS_FORCE_OFF) CommonSimEventDispatcherService( )._on_sim_change_gender_options_breasts(sim_info) return True return False
def _try_apply_traits(self, sim_info: SimInfo): if CommonSpeciesUtils.is_human(sim_info): CommonTraitUtils.remove_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_LARGE_DOG, CommonTraitId.S4CL_MAIN_TRAIT_SMALL_DOG, CommonTraitId.S4CL_MAIN_TRAIT_CAT) if CommonTraitUtils.has_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_HUMAN): return CommonTraitUtils.add_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_HUMAN) elif CommonSpeciesUtils.is_large_dog(sim_info): CommonTraitUtils.remove_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_HUMAN, CommonTraitId.S4CL_MAIN_TRAIT_SMALL_DOG, CommonTraitId.S4CL_MAIN_TRAIT_CAT) if CommonTraitUtils.has_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_LARGE_DOG): return CommonTraitUtils.add_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_LARGE_DOG) elif CommonSpeciesUtils.is_small_dog(sim_info): CommonTraitUtils.remove_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_HUMAN, CommonTraitId.S4CL_MAIN_TRAIT_LARGE_DOG, CommonTraitId.S4CL_MAIN_TRAIT_CAT) if CommonTraitUtils.has_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_SMALL_DOG): return CommonTraitUtils.add_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_SMALL_DOG) elif CommonSpeciesUtils.is_cat(sim_info): CommonTraitUtils.remove_trait( sim_info, CommonTraitId.S4CL_MAIN_TRAIT_HUMAN, CommonTraitId.S4CL_MAIN_TRAIT_LARGE_DOG, CommonTraitId.S4CL_MAIN_TRAIT_SMALL_DOG) if CommonTraitUtils.has_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_CAT): return CommonTraitUtils.add_trait(sim_info, CommonTraitId.S4CL_MAIN_TRAIT_CAT)
def run( self, sim_info: SimInfo, on_completed: Callable[[bool], None] = CommonFunctionUtils.noop) -> bool: if not CommonOccultUtils.is_mermaid(sim_info): on_completed(False) return False from sims4communitylib.utils.sims.common_trait_utils import CommonTraitUtils trait_ids: Tuple[int] = ( CommonTraitId.OCCULT_MERMAID_MERMAID_FORM, CommonTraitId.OCCULT_MERMAID_DISCOVERED, CommonTraitId.OCCULT_MERMAID_TEMPORARY_DISCOVERED, CommonTraitId.OCCULT_MERMAID_TYAE, CommonTraitId.OCCULT_MERMAID, ) result = CommonTraitUtils.remove_trait(sim_info, *trait_ids) on_completed(result) return result