def adopt(self, seeder):
        for coll in services.get_adoption_service()._sim_infos.values():
            for item in coll:

                item = services.get_adoption_service(
                ).convert_base_sim_info_to_full(item.sim_id)
                services.get_adoption_service().remove_sim_info(item)
                PregnancyTracker.initialize_sim_info(item, self, seeder)

                return
def simulate_adoption(first_name1='', last_name1='', _connection=None):
    output = sims4.commands.CheatOutput(_connection)
    output(first_name1 + " " + last_name1 + " is adopting...")
    for coll in services.get_adoption_service()._sim_infos.values():
        for item in coll:
            item = services.get_adoption_service(
            ).convert_base_sim_info_to_full(item.sim_id)
            services.get_adoption_service().remove_sim_info(item)

            first_sim_info = services.sim_info_manager().get_sim_info_by_name(
                first_name1, last_name1)
            PregnancyTracker.initialize_sim_info(item, first_sim_info, None)

            return
Exemple #3
0
def remove_sim_info(opt_sim: OptionalSimInfoParam = None, _connection=None):
    sim_info = get_optional_target(opt_sim,
                                   target_type=OptionalSimInfoParam,
                                   _connection=_connection)
    if sim_info is None:
        return False
    adoption_service = services.get_adoption_service()
    adoption_service.remove_sim_info(sim_info)
    return True
Exemple #4
0
 def picker_rows_gen(cls, inst, target, context, **kwargs):
     inst_or_cls = inst if inst is not None else cls
     adoption_service = services.get_adoption_service()
     with adoption_service.real_sim_info_cache():
         for entry in inst_or_cls.picker_entries:
             for sim_info in adoption_service.get_sim_infos(entry.count, entry.creation_data.age, entry.creation_data.gender, entry.creation_data.species):
                 aging_data = AgingTuning.get_aging_data(sim_info.species)
                 age_transition_data = aging_data.get_age_transition_data(sim_info.age)
                 row_description = age_transition_data.age_trait.display_name(sim_info)
                 yield SimPickerRow(sim_id=sim_info.sim_id, tag=sim_info.sim_id, row_description=row_description)
Exemple #5
0
 def __call__(self, interaction, picked_sim_ids):
     guest_list = SituationGuestList(invite_only=True)
     adoption_service = services.get_adoption_service()
     for sim_id in picked_sim_ids:
         replacement_sim_info = adoption_service.convert_base_sim_info_to_full(sim_id)
         if replacement_sim_info is None:
             sim_id_to_adopt = sim_id
         else:
             sim_id_to_adopt = replacement_sim_info.sim_id
         guest_list.add_guest_info(SituationGuestInfo(sim_id_to_adopt, self.adoptee_situation_job, RequestSpawningOption.DONT_CARE, BouncerRequestPriority.EVENT_VIP, reservation=True))
     services.get_zone_situation_manager().create_situation(self.situation_type, guest_list=guest_list, user_facing=False)
 def get_participants(cls, inst, participant_type, *args,
                      **interaction_parameters):
     inst_or_cls = inst if inst is not None else cls
     if participant_type == ParticipantType.PickedSim:
         _interaction_parameters = inst.interaction_parameters if inst is not None else interaction_parameters
         adopted_sim_id = next(
             iter(_interaction_parameters.get('picked_item_ids')))
         adoption_service = services.get_adoption_service()
         adopted_sim_info = adoption_service.get_sim_info(adopted_sim_id)
         if adopted_sim_info is not None:
             return {adopted_sim_info}
     return super(__class__,
                  inst_or_cls).get_participants(participant_type, *args,
                                                **interaction_parameters)
 def _name_and_create_adoptee_gen(self, timeline):
     adopted_sim_info = self.get_participant(ParticipantType.PickedSim)
     if adopted_sim_info is None:
         return False
         yield
     last_name = SimSpawner.get_last_name(self.sim.last_name,
                                          adopted_sim_info.gender,
                                          adopted_sim_info.species)
     result = yield from self._do_renames_gen(
         timeline, (adopted_sim_info, ), additional_tokens=(last_name, ))
     if not result:
         return result
         yield
     parent_a = self.sim.sim_info
     parent_b = services.sim_info_manager().get(parent_a.spouse_sim_id)
     adoption_service = services.get_adoption_service()
     adoption_service.remove_sim_info(adopted_sim_info)
     (adopted_sim_info, _) = adoption_service.create_adoption_sim_info(
         adopted_sim_info,
         household=parent_a.household,
         account=parent_a.account,
         zone_id=parent_a.household.home_zone_id)
     PregnancyTracker.initialize_sim_info(adopted_sim_info, parent_a,
                                          parent_b)
     self.interaction_parameters['picked_item_ids'] = {
         adopted_sim_info.sim_id
     }
     services.daycare_service().exclude_sim_from_daycare(adopted_sim_info)
     if adopted_sim_info.age == Age.BABY:
         adopted_sim_info.set_zone_on_spawn()
         if not assign_bassinet_for_baby(adopted_sim_info):
             create_and_place_baby(adopted_sim_info)
     else:
         SimSpawner.spawn_sim(adopted_sim_info,
                              sim_position=self.sim.position)
     return True
     yield
 def on_remove_sim_from_situation(self, sim):
     if self.owner.pet_sim_id == sim.sim_id:
         if self.owner.add_pet_to_adoption_pool:
             adoption_service = services.get_adoption_service()
             adoption_service.add_real_sim_info(sim.sim_info)
         self._change_state(self.owner.leave_state())