Пример #1
0
def get_season_info(_connection=None):
    content = services.season_service().season_content
    sims4.commands.output('Season: {}'.format(services.season_service().season), _connection)
    sims4.commands.output('GameClock Progress: {}'.format(content.get_progress(services.game_clock_service().now())), _connection)
    sims4.commands.output('Simulation Progress: {}'.format(content.get_progress(services.time_service().sim_now)), _connection)
    sims4.commands.output(content.info, _connection)
    return True
Пример #2
0
 def _apply_to_subject_and_target(self, subject, target, resolver):
     season_service = services.season_service()
     if season_service is not None:
         season_service.reset_region_season_params()
         season_service.set_season(self.season,
                                   SeasonSetSource.LOOT,
                                   interp_time=self.interpolation_time)
 def _ui_metadata_gen(self):
     yield from super()._ui_metadata_gen()
     season_service = services.season_service()
     if season_service is not None:
         season_text = GardeningTuning.get_seasonality_text_from_plant(
             self.plant)
         if season_text:
             yield (TooltipFields.season_text.name, season_text)
Пример #4
0
 def _send_interpolation_update(self, mid_season_op=False):
     season_service = services.season_service()
     season = season_service.season
     content = season_service.season_content
     op = SeasonInterpolationOp(season, content, mid_season_op)
     Distributor.instance().add_op_with_no_owner(op)
     if not mid_season_op:
         self._schedule_mid_season_interpolation_update()
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self._object_layer_schedule = None
     self._current_layers = {}
     self._destruction_alarms = {}
     self._layers_in_destruction = []
     if services.season_service() is not None:
         services.get_event_manager().register_single_event(
             self, TestEvent.SeasonChangedNoSim)
Пример #6
0
def generate_season_interpolation_ops(num_seasons:int=1, _connection=None):
    season_service = services.season_service()
    for (season, content) in season_service.get_seasons(num_seasons):
        sims4.commands.output('Season: {}'.format(season), _connection)
        sims4.commands.output('Time: {} -> {}'.format(repr(content.start_time), repr(content.end_time)), _connection)
        op = SeasonInterpolationOp(season, content, mid_season_op=False)
        sims4.commands.output('\nBegin {}@{}:\n{}'.format(season.name, repr(content.start_time), op.content), _connection)
        op = SeasonInterpolationOp(season, content, mid_season_op=True)
        sims4.commands.output('\nMid-{}@{}:\n{}'.format(season.name, repr(content.midpoint_time), op.content), _connection)
 def _create_new_object_layer_schedule(self, start_callback, init_only):
     season_service = services.season_service()
     if season_service is not None:
         season_object_layer_schedule = self.seasonal_object_layer_schedule_mapping.get(
             season_service.season, None)
         if season_object_layer_schedule is not None:
             return season_object_layer_schedule(
                 start_callback=start_callback, init_only=init_only)
     return self.object_layer_schedule(start_callback=start_callback,
                                       init_only=init_only)
 def get_definition_notebook_data(self, ingredient_cache=()):
     definition_manager = services.definition_manager()
     fruit_definition = definition_manager.get(
         self.entry_object_definition_id)
     if fruit_definition is None:
         return
     gardening_tuned_values = fruit_definition.cls._components.gardening._tuned_values
     plant_definition = gardening_tuned_values.plant
     sub_list_data = []
     sub_list_data.append(
         SubListData(None, 0, 0, True, False,
                     self.entry_text_value(fruit_definition.price / 5),
                     None, None))
     season_service = services.season_service()
     if season_service is not None:
         season_text = GardeningTuning.get_seasonality_text_from_plant(
             plant_definition)
         if season_text is None:
             season_text = GardeningTuning.PLANT_SEASONALITY_TEXT(
                 GardeningTuning.SEASONALITY_ALL_SEASONS_TEXT)
         sub_list_data.append(
             SubListData(None, 0, 0, True, False, season_text, None, None))
     sub_list_data.append(
         SubListData(
             None, 0, 0, True, False,
             LocalizationHelperTuning.get_object_description(
                 plant_definition), None, None))
     for (splice_fruit, splice_fruit_result
          ) in gardening_tuned_values.splicing_recipies.items():
         sub_list_data.append(
             SubListData(
                 None, 0, 0, True, False,
                 self.entry_text_splicing(splice_fruit,
                                          splice_fruit_result), None, None))
     gardening_collection_data = ObjectCollectionData.get_collection_data(
         CollectionIdentifier.Gardening)
     for obj_data in itertools.chain(
             gardening_collection_data.object_list,
             gardening_collection_data.bonus_object_list):
         if obj_data.collectable_item is fruit_definition:
             rarity_text = ObjectCollectionData.COLLECTION_RARITY_MAPPING[
                 obj_data.rarity].text_value
             sub_list_data.append(
                 SubListData(None, 0, 0, True, False,
                             self.entry_text_rarity(rarity_text), None,
                             None))
             break
     entry_data = EntryData(
         LocalizationHelperTuning.get_object_name(fruit_definition),
         IconInfoData(obj_def_id=fruit_definition.id), None, sub_list_data,
         None)
     return entry_data
Пример #9
0
 def on_all_households_and_sim_infos_loaded(self, client):
     holiday_ids_to_ignore = {
         drama_node.holiday_id
         for drama_node in
         services.drama_scheduler_service().all_nodes_gen()
         if type(drama_node) is HolidayService.CUSTOM_HOLIDAY_DRAMA_NODE
     }
     if not self._holiday_times:
         for season_length in SeasonLength:
             self._holiday_times[season_length] = YearOfHolidays(
                 season_length)
         for (season_type, season_content
              ) in services.season_service().get_four_seasons():
             for (season_length, holiday,
                  day_of_season) in season_content.get_all_holiday_data():
                 self._holiday_times[season_length].add_holiday(
                     season_type, day_of_season, holiday.guid64)
     self._schedule_all_holidays(holiday_ids_to_ignore)
Пример #10
0
 def _schedule_all_holidays(self, holiday_ids_to_ignore=()):
     resolver = DataResolver(None)
     season_service = services.season_service()
     current_season_length = season_service.season_length_option
     drama_scheduler = services.drama_scheduler_service()
     season_data = defaultdict(list)
     for (season_type,
          season_content) in season_service.get_seasons_for_scheduling():
         season_data[season_type].append(season_content)
     for (season, day, holiday_id) in self._holiday_times[
             current_season_length].holidays_to_schedule_gen():
         if holiday_id in holiday_ids_to_ignore:
             continue
         for season_content in season_data[season]:
             holiday_start_time = season_content.start_time + create_time_span(
                 days=day)
             drama_scheduler.schedule_node(
                 HolidayService.CUSTOM_HOLIDAY_DRAMA_NODE,
                 resolver,
                 specific_time=holiday_start_time,
                 holiday_id=holiday_id)
Пример #11
0
 def get_active_whimsets(self):
     whim_sets = set(self._active_whimsets_data.keys())
     if self._sim_info.primary_aspiration is not None and self._sim_info.primary_aspiration.whim_set is not None:
         whim_sets.add(self._sim_info.primary_aspiration.whim_set)
     current_venue = services.get_current_venue()
     if current_venue.whim_set is not None:
         whim_sets.add(current_venue.whim_set)
     for trait in self._sim_info.trait_tracker:
         if trait.whim_set is not None:
             whim_sets.add(trait.whim_set)
     season_service = services.season_service()
     if season_service is not None:
         season_content = season_service.season_content
         if season_content.whim_set is not None:
             whim_sets.add(season_content.whim_set)
     object_manager = services.object_manager()
     whim_sets.update(object_manager.active_whim_sets)
     zone_director = services.venue_service().get_zone_director()
     open_street_director = zone_director.open_street_director
     if open_street_director is not None and open_street_director.whim_set:
         whim_sets.add(open_street_director.whim_set)
     return whim_sets
Пример #12
0
 def __call__(self):
     season_service = services.season_service()
     if season_service is None:
         if self.requires_seasons_pack:
             return TestResult(False,
                               'Season service not available.',
                               tooltip=self.tooltip)
         return TestResult.TRUE
     if season_service.season not in self.seasons:
         return TestResult(False,
                           'Currently {}, but we want one of {}',
                           season_service.season,
                           self.seasons,
                           tooltip=self.tooltip)
     if self.time_of_season is not None and season_service.season_content.get_segment(
             services.time_service().sim_now) not in self.time_of_season:
         return TestResult(False,
                           'Currently {}, but we want one of {}',
                           season_service.season_content.get_segment(
                               services.time_service().sim_now),
                           self.time_of_season,
                           tooltip=self.tooltip)
     return TestResult.TRUE
Пример #13
0
 def _schedule_holiday(self, holiday_id):
     resolver = DataResolver(None)
     season_service = services.season_service()
     current_season_length = season_service.season_length_option
     drama_scheduler = services.drama_scheduler_service()
     (season,
      day) = self._holiday_times[current_season_length].get_holiday_data(
          holiday_id)
     if season is None:
         logger.error(
             'Trying to schedule holiday of id {} which is not actually scheduled to run at any time.'
         )
         return
     for (season_type,
          season_content) in season_service.get_seasons_for_scheduling():
         if season_type != season:
             continue
         holiday_start_time = season_content.start_time + create_time_span(
             days=day)
         drama_scheduler.schedule_node(
             HolidayService.CUSTOM_HOLIDAY_DRAMA_NODE,
             resolver,
             specific_time=holiday_start_time,
             holiday_id=holiday_id)
Пример #14
0
def set_season(season:SeasonType, interp_time:int=None, _connection=None):
    services.season_service().reset_region_season_params()
    services.season_service().set_season(season, SeasonSetSource.CHEAT, interp_time)
    if interp_time is None:
        services.weather_service().reset_forecasts()
    return True
Пример #15
0
def get_season_timeline_element_infos(_connection=None):
    season_service = services.season_service()
    for timeline_element_info in season_service.get_timeline_element_infos():
        sims4.commands.output('Element: {}'.format(timeline_element_info), _connection)
Пример #16
0
 def get_sunset_time(cls):
     season_service = services.season_service()
     if season_service is None:
         return cls.sunset_time
     return cls.seasonal_sunset_time.get(season_service.season,
                                         cls.sunset_time)
Пример #17
0
def shift_season_by_weeks(weeks:int, _connection=None):
    services.season_service().reset_region_season_params()
    services.season_service().shift_season_by_weeks(weeks)
    services.weather_service().reset_forecasts()
    services.season_service().handle_season_content_updated()
    return True
Пример #18
0
def set_season_length(length:SeasonLength, _connection=None):
    services.season_service().reset_region_season_params()
    services.season_service().set_season_length(length)
    services.weather_service().reset_forecasts()
    services.season_service().handle_season_content_updated()
    return True
Пример #19
0
def advance_season(_connection=None):
    services.season_service().reset_region_season_params()
    services.season_service().advance_season(SeasonSetSource.CHEAT)
    services.weather_service().reset_forecasts()
    return True
Пример #20
0
 def on_finalize_load(self):
     self.on_season_set(services.season_service().season)
Пример #21
0
 def on_add(self):
     self.on_season_set(services.season_service().season)
Пример #22
0
 def _send_season_ui_update(self):
     season_service = services.season_service()
     season = season_service.season
     content = season_service.season_content
     op = SeasonUpdateOp(season, content)
     Distributor.instance().add_op_with_no_owner(op)
 def on_shutdown(self):
     self._remove_object_layer_schedule()
     if services.season_service() is not None:
         services.get_event_manager().unregister_single_event(
             self, TestEvent.SeasonChangedNoSim)
     super().on_shutdown()