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 get_species(sim_info: SimInfo) -> int: """ Retrieve the CommonSpecies of a sim. Use this instead of CommonSpeciesUtils.get_species to determine a more specific species. """ from sims4communitylib.utils.sims.common_species_utils import CommonSpeciesUtils if CommonSpeciesUtils.is_human(sim_info): return CommonSpecies.HUMAN elif CommonSpeciesUtils.is_small_dog(sim_info): return CommonSpecies.SMALL_DOG elif CommonSpeciesUtils.is_large_dog(sim_info): return CommonSpecies.LARGE_DOG elif CommonSpeciesUtils.is_cat(sim_info): return CommonSpecies.CAT return CommonSpecies.INVALID
def get_species(sim_info: SimInfo) -> 'CommonSpecies': """get_species(sim_info) Retrieve the CommonSpecies of a sim. Use this instead of CommonSpeciesUtils.get_species to determine a more specific species. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: A species matching the Sim or CommonSpecies.INVALID if no matching species is found. :rtype: CommonSpecies """ from sims4communitylib.utils.sims.common_species_utils import CommonSpeciesUtils if CommonSpeciesUtils.is_human(sim_info): return CommonSpecies.HUMAN elif CommonSpeciesUtils.is_small_dog(sim_info): return CommonSpecies.SMALL_DOG elif CommonSpeciesUtils.is_large_dog(sim_info): return CommonSpecies.LARGE_DOG elif CommonSpeciesUtils.is_cat(sim_info): return CommonSpecies.CAT return CommonSpecies.INVALID
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)