示例#1
0
 def add_trait(sim_info: SimInfo, *trait_ids: int) -> bool:
     """
         Add the specified traits to a sim.
     :param sim_info: The sim to add the specified traits to.
     :param trait_ids: The decimal identifiers of traits being added.
     :return: True if all of the traits were successfully added to the sim.
     """
     success = True
     for trait_id in trait_ids:
         trait_instance = CommonTraitUtils._load_trait_instance(trait_id)
         if trait_instance is None:
             continue
         if not sim_info.add_trait(trait_instance):
             success = False
     return success
    def add_trait(sim_info: SimInfo, *trait_ids: Union[int, CommonTraitId]) -> bool:
        """add_trait(sim_info, *trait_ids)

        Add the specified traits to a Sim.

        :param sim_info: The Sim to add the specified traits to.
        :type sim_info: SimInfo
        :param trait_ids: An iterable of Trait identifiers of traits being added.
        :type trait_ids: Union[int, CommonTraitId]
        :return: True, if all specified traits were successfully added to the Sim. False, if not.
        :rtype: bool
        """
        success = True
        for trait_id in trait_ids:
            trait_instance = CommonTraitUtils.load_trait_by_id(trait_id)
            if trait_instance is None:
                continue
            if not sim_info.add_trait(trait_instance):
                success = False
        return success