from event_testing.tests import TunableTestSet
from sims4.tuning.tunable import HasTunableFactory, AutoFactoryInit
from snippets import define_snippet
from ui.ui_dialog_notification import UiDialogNotification

class TestedUiDialogNotification(UiDialogNotification):
    FACTORY_TUNABLES = {'tests': TunableTestSet(description='\n            The test(s) to decide whether the notification is to be shown.\n            ')}

    def show_dialog(self, **kwargs):
        if self.tests:
            test_result = self.tests.run_tests(self._resolver)
            if not test_result:
                return
        return super().show_dialog(**kwargs)

(TunableTestedUiDialogNotificationReference, TunableTestedUiDialogNotificationSnippet) = define_snippet('tested_notification', TestedUiDialogNotification.TunableFactory())
Esempio n. 2
0
        Tunable(
            description=
            '\n            If checked, this audio will be triggered immediately, nothing\n            will block.\n            \n            ex. Earbuds audio will be played immediately while \n            the Sim is routing or animating.\n            \n            This is passed down to the audio state when it is triggered, and thus\n            will overwrite any tuning on the state value.\n            ',
            tunable_type=bool,
            default=False)
    }

    def is_stereo_turned_on(self):
        current_channel = self.owner.get_state(self.channel_state)
        return current_channel != self.off_state

    def get_available_picker_channel_states(self, context):
        for client_state in self.owner.get_client_states(self.channel_state):
            if client_state.show_in_picker:
                if client_state.test_channel(self.owner, context):
                    yield client_state

    def component_potential_interactions_gen(self, context, **kwargs):
        current_channel = self.owner.get_state(self.channel_state)
        if current_channel != self.off_state:
            for listen_affordance in self.listen_affordances:
                yield from listen_affordance.potential_interactions(
                    self.owner,
                    context,
                    required_station=current_channel,
                    off_state=self.off_state,
                    **kwargs)


(_, TunableStereoComponentSnippet) = define_snippet(
    'stereo_component', StereoComponent.TunableFactory())
Esempio n. 3
0
    @property
    def late_violators(self):
        return self._late_violators

    def remove_late_violator(self, sim):
        self.remove_override_for_sim(sim)
        self._late_violators.discard(sim)

class TunablePrivacy(TunableFactory):
    __qualname__ = 'TunablePrivacy'
    FACTORY_TYPE = Privacy

    def __init__(self, description='Generate a privacy region for this object', callback=None, **kwargs):
        super().__init__(tests=TunableTestSet(description='Any Sim who passes these tests will be allowed to violate the privacy region.'), max_line_of_sight_radius=Tunable(float, 5, description='The maximum possible distance from this object than an interaction can reach.'), map_divisions=Tunable(int, 30, description='The number of points around the object to check collision from.  More points means higher accuracy.'), simplification_ratio=Tunable(float, 0.25, description='A factor determining how much to combine edges in the line of sight polygon.'), boundary_epsilon=Tunable(float, 0.01, description='The LOS origin is allowed to be outside of the boundary by this amount.'), facing_offset=Tunable(float, 0.1, description='The LOS origin is offset from the object origin by this amount (mainly to avoid intersecting walls).'), description=description, **kwargs)

(_, TunablePrivacySnippet) = snippets.define_snippet('Privacy', TunablePrivacy())
SHOO_LIABILITY = 'ShooLiability'

class ShooLiability(Liability):
    __qualname__ = 'ShooLiability'

    def __init__(self, privacy, sim):
        self._privacy = privacy
        self._sim = sim

    def release(self):
        if self._privacy.is_active:
            if self._sim in self._privacy.find_violating_sims():
                self._privacy.interaction.cancel(FinishingType.LIABILITY, cancel_reason_msg='Shoo. Failed to route away from privacy region.')
            else:
                self._privacy.remove_violator(self._sim)
Esempio n. 4
0
            if self.participant is not None:
                participant = self._resolver.get_participant(self.participant)
                if participant is not None:
                    icon_override = IconInfoData(obj_instance=participant)
        msg = super().build_msg(icon_override=icon_override,
                                additional_tokens=additional_tokens,
                                **kwargs)
        msg.dialog_type = Dialog_pb2.UiDialogMessage.NOTIFICATION
        notification_msg = msg.Extensions[
            Dialog_pb2.UiDialogNotification.dialog]
        notification_msg.expand_behavior = self.expand_behavior
        notification_msg.criticality = self.urgency
        notification_msg.information_level = self.information_level
        notification_msg.visual_type = self.visual_type
        if career_args is not None:
            notification_msg.career_args = career_args
        if self.primary_icon_response is not None:
            self._build_response_arg(self.primary_icon_response,
                                     notification_msg.primary_icon_response,
                                     **kwargs)
        if self.secondary_icon_response is not None:
            self._build_response_arg(self.secondary_icon_response,
                                     notification_msg.secondary_icon_response,
                                     **kwargs)
        return msg


(TunableUiDialogNotificationReference,
 TunableUiDialogNotificationSnippet) = define_snippet(
     'Notification', UiDialogNotification.TunableFactory())
Esempio n. 5
0
        if retail_manager is None:
            return
        sellable_data = self.sellable
        if sellable_data is not None:
            if self.is_for_sale:
                yield from sellable_data.for_sale_extra_affordances
                if sellable_data.set_not_for_sale_affordance is not None:
                    yield sellable_data.set_not_for_sale_affordance
                    if retail_manager.is_open:
                        if sellable_data.buy_affordance is not None:
                            yield sellable_data.buy_affordance
                        if sellable_data.browse_affordance is not None:
                            yield sellable_data.browse_affordance
            elif self.is_not_for_sale:
                if sellable_data.set_for_sale_affordance is not None and self.get_can_be_sold(
                ):
                    yield sellable_data.set_for_sale_affordance
            elif self.is_sold:
                yield from sellable_data.restock_affordances
                if sellable_data.clear_placard_affordance is not None:
                    yield sellable_data.clear_placard_affordance

    def modify_interactable_flags(self, interactable_flag_field):
        if self.is_for_sale:
            if not self.is_sold:
                interactable_flag_field.flags |= interaction_protocol.Interactable.FORSALE


(TunableRetailComponentReference,
 TunableRetailComponentSnippet) = define_snippet(
     'Retail_Component', RetailComponent.TunableFactory())
Esempio n. 6
0
class ScreenSlamSizeEnum(enum.Int):
    __qualname__ = 'ScreenSlamSizeEnum'
    SMALL = 0
    MEDIUM = 1
    LARGE = 2
    EXTRA_LARGE = 3

class ScreenSlam(HasTunableSingletonFactory, AutoFactoryInit):
    __qualname__ = 'ScreenSlam'
    FACTORY_TUNABLES = {'screen_slam_size': TunableEnumEntry(description='\n            Screen slam type.\n            ', tunable_type=ScreenSlamSizeEnum, default=ScreenSlamSizeEnum.MEDIUM), 'title': OptionalTunable(description='\n            Title of the screen slam.\n            ', tunable=sims4.localization.TunableLocalizedStringFactory()), 'text': sims4.localization.TunableLocalizedStringFactory(description='"\n            Text of the screen slam.\n            ', export_modes=sims4.tuning.tunable_base.ExportModes.All), 'icon': sims4.tuning.tunable.TunableResourceKey(description=',\n            Icon to be displayed for the screen Slam.\n            ', default=None, resource_types=sims4.resources.CompoundTypes.IMAGE), 'audio_sting': OptionalTunable(description='\n            A sting to play at the same time as the screen slam.\n            ***Some screen slams may appear to play a sting, but the audio is\n            actually tuned on something else.  Example: On CareerLevel tuning\n            there already is a tunable, Promotion Audio Sting, to trigger a\n            sting, so one is not necessary on the screen slam.  Make sure to\n            avoid having to stings play simultaneously.***\n            ', tunable=TunablePlayAudio()), 'active_sim_only': Tunable(description='\n            If true, the screen slam will be only be shown if the active Sim\n            triggers it.\n            ', tunable_type=bool, default=True)}

    def send_screen_slam_message(self, sim_info, *localization_tokens):
        msg = protocolbuffers.UI_pb2.UiScreenSlam()
        msg.type = self.screen_slam_size
        msg.size = self.screen_slam_size
        msg.name = self.text(*(token for token in itertools.chain(localization_tokens)))
        if sim_info is not None:
            msg.sim_id = sim_info.sim_id
        if self.icon is not None:
            msg.icon.group = self.icon.group
            msg.icon.instance = self.icon.instance
            msg.icon.type = self.icon.type
        if self.title is not None:
            msg.title = self.title(*(token for token in itertools.chain(localization_tokens)))
        if self.active_sim_only and sim_info is not None and sim_info.is_selected or not self.active_sim_only:
            distributor.shared_messages.add_message_if_player_controlled_sim(sim_info, protocolbuffers.Consts_pb2.MSG_UI_SCREEN_SLAM, msg, False)
            if self.audio_sting is not None:
                play_tunable_audio(self.audio_sting)

(TunableScreenSlamReference, TunableScreenSlamSnippet) = define_snippet(SCREEN_SLAM, ScreenSlam.TunableFactory())
        if not self.possible_fish:
            logger.error(
                "FishingData has an empty list of Possible Fish. This isn't much of a fishing location if there aren't any fish.\n{}",
                self)
        else:
            for fish in self.possible_fish:
                while fish.fish is None or not issubclass(
                        fish.fish.cls, fishing.fish_object.Fish):
                    logger.error(
                        "Possible Fish on Fishing Data has been tuned but there either isn't a definition tuned for the fish, or the definition currently tuned is not a Fish.\n{}",
                        self)

    def get_possible_fish_gen(self):
        yield self.possible_fish

    def choose_fish(self, resolver):
        weighted_fish = [(f.weight, f.fish) for f in self.possible_fish
                         if f.fish.cls.can_catch(resolver, require_bait=True)]
        if weighted_fish:
            return sims4.random.weighted_random_item(weighted_fish)

    def choose_treasure(self):
        weighted_treasures = [(t.weight, t.treasure)
                              for t in self.possible_treasures]
        if weighted_treasures:
            return sims4.random.weighted_random_item(weighted_treasures)


(_, TunableFishingDataSnippet) = snippets.define_snippet(
    'fishing_data', FishingData.TunableFactory())
    def distribute_dialog(self, dialog_type, dialog_msg):
        distributor = Distributor.instance()
        notification_op = GenericProtocolBufferOp(Operation.UI_NOTIFICATION_SHOW, dialog_msg)
        owner = self.owner
        if owner is not None:
            distributor.add_op(owner, notification_op)
        else:
            distributor.add_op_with_no_owner(notification_op)

    def build_msg(self, additional_tokens=(), icon_override=DEFAULT, event_id=None, career_args=None, **kwargs):
        if icon_override is DEFAULT and self.participant is not None:
            participant = self._resolver.get_participant(self.participant)
            if participant is not None:
                icon_override = (None, participant)
        msg = super().build_msg(icon_override=icon_override, additional_tokens=additional_tokens, **kwargs)
        msg.dialog_type = Dialog_pb2.UiDialogMessage.NOTIFICATION
        notification_msg = msg.Extensions[Dialog_pb2.UiDialogNotification.dialog]
        notification_msg.expand_behavior = self.expand_behavior
        notification_msg.criticality = self.urgency
        notification_msg.information_level = self.information_level
        notification_msg.visual_type = self.visual_type
        if career_args is not None:
            notification_msg.career_args = career_args
        if self.primary_icon_response is not None:
            self._build_response_arg(self.primary_icon_response, notification_msg.primary_icon_response, **kwargs)
        if self.secondary_icon_response is not None:
            self._build_response_arg(self.secondary_icon_response, notification_msg.secondary_icon_response, **kwargs)
        return msg

(TunableUiDialogNotificationReference, TunableUiDialogNotificationSnippet) = define_snippet('Notification', UiDialogNotification.TunableFactory())
Esempio n. 9
0
        if action.cost is not None:
            if action.cost.cost_type == self.COST_TYPE_SIMOLEONS:
                amount = action.cost.amount
                display_name = self._interaction.SIMOLEON_COST_NAME_FACTORY(display_name, amount)
            elif action.cost.cost_type == self.COST_TYPE_ITEMS:
                item_cost = action.cost.item_cost
                display_name = item_cost.get_interaction_name(self._interaction, display_name)
        return lambda *_, **__: display_name

    def _get_dialog(self):
        dialog = self._visibility(self._sim, self._interaction.get_resolver())
        dialog.set_responses(tuple(UiDialogResponse(dialog_response_id=i, text=self._get_action_display_text(action)) for (i, action) in enumerate(self._finish_actions)))
        dialog.add_listener(self._on_dialog_response)
        return dialog

(TunableAdventureMomentReference, TunableAdventureMomentSnippet) = define_snippet('Adventure_Moment', AdventureMoment.TunableFactory())

class Adventure(XevtTriggeredElement, HasTunableFactory, AutoFactoryInit):
    __qualname__ = 'Adventure'
    FACTORY_TUNABLES = {'description': '\n            A series of individual moments linked together in a game-like\n            fashion.\n            ', '_adventure_moments': TunableMapping(description='\n            The individual adventure moments for this adventure. Every moment\n            used in the adventure must be defined here. For instance, if there\n            is an adventure moment that triggers another adventure moment, the\n            latter must also be defined in this list.\n            ', key_type=AdventureMomentKey, value_type=TunableAdventureMomentSnippet()), '_initial_moments': TunableList(description='\n            A list of adventure moments that are valid as initiating moments for\n            this adventure.\n            ', tunable=TunableTuple(description='\n                A tuple of moment key and weight. The higher the weight, the\n                more likely it is this moment will be selected as the initial\n                moment.\n                ', adventure_moment_key=TunableEnumEntry(description='\n                    The key of the initial adventure moment.\n                    ', tunable_type=AdventureMomentKey, default=AdventureMomentKey.INVALID), weight=TunableMultiplier.TunableFactory(description='\n                    The weight of this potential initial moment relative\n                    to other items within this list.\n                    '))), '_trigger_interval': TunableInterval(description='\n            The interval, in Sim minutes, between the end of one adventure\n            moment and the beginning of the next one.\n            ', tunable_type=float, default_lower=8, default_upper=12, minimum=0), '_maximum_triggers': Tunable(description='\n            The maximum number of adventure moments that can be triggered by\n            this adventure. Any moment being generated from the adventure beyond\n            this limit will be discarded. Set to 0 to allow for an unlimited\n            number of adventure moments to be triggered.\n            ', tunable_type=int, default=0), '_resumable': Tunable(description='\n            A Sim who enters a resumable adventure will restart the same\n            adventure at the moment they left it at.\n            ', tunable_type=bool, needs_tuning=True, default=True)}

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._adventure_moment_count = 0
        self._alarm_handle = None
        self._canceled = False

    def _build_outer_elements(self, sequence):
        return build_critical_section_with_finally(sequence, self._end_adventure)

    def _end_adventure(self, *_, **__):
Esempio n. 10
0
        if level == len(relbit_based_loot.relationship):
            resolver = DoubleSimResolver(source_info, cur_info)
            for loot in relbit_based_loot.loot:
                loot.apply_to_resolver(resolver)
            return
        relationship_tracker = cur_info.relationship_tracker
        for target_sim_id in relationship_tracker.target_sim_gen():
            if set(relationship_tracker.get_all_bits(target_sim_id)) & relbit_based_loot.relationship[level]:
                new_sim_info = services.sim_info_manager().get(target_sim_id)
                self._apply_aging_transition_relbit_loot(source_info, new_sim_info, relbit_based_loot, level + 1)

    def apply_aging_transition_loot(self, sim_info):
        if self.per_household_member_loot:
            for member_info in sim_info.household.sim_info_gen():
                if member_info is sim_info:
                    continue
                resolver = DoubleSimResolver(sim_info, member_info)
                for household_loot in self.per_household_member_loot:
                    household_loot.apply_to_resolver(resolver)
        for relbit_based_loot in self.relbit_based_loot:
            self._apply_aging_transition_relbit_loot(sim_info, sim_info, relbit_based_loot, 0)
        resolver = SingleSimResolver(sim_info)
        for loot in self.single_sim_loot:
            loot.apply_to_resolver(resolver)

    def show_age_transition_dialog(self, sim_info, **kwargs):
        if self.age_transition_dialog is not None:
            self.age_transition_dialog(sim_info, **kwargs)

(TunableAgingTransitionReference, _) = define_snippet('Aging_Transition', AgingTransition.TunableFactory())
Esempio n. 11
0
            '\n            A set of states in which the gate in this room can potentially\n            start.\n            ',
            tunable=TunableReference(
                description=
                '\n                A potential starting state for the gate in this room.\n                ',
                manager=services.get_instance_manager(
                    sims4.resources.Types.OBJECT_STATE),
                class_restrictions=('ObjectStateValue', ))),
        'traps':
        TunableMapping(
            description=
            '\n            A mapping of trap objects to the interactions that can be used in\n            the pool potential of "trigger" interaction. A trap object will be\n            chosen at random from this mapping and placed at each placeholder\n            trap in this room. Once all trap objects have been chosen and placed\n            for a room, all of the mapped interactions will be collected and one\n            random interaction will be chosen as the "trigger" interaction.\n            ',
            key_name='Trap',
            key_type=TunableReference(
                description=
                '\n                A reference to the trap object.\n                ',
                manager=services.definition_manager()),
            value_name='Potential Trigger Interactions',
            value_type=TunableSet(
                description=
                '\n                A set of interactions that, if successfully completed on the\n                chosen trap object, will trigger the loot for the gate in this\n                room.\n                ',
                tunable=TunableReference(
                    description=
                    '\n                    One of the potential trigger interactions. This interaction\n                    also needs to be tuned on the object chosen for this trap.\n                    ',
                    manager=services.get_instance_manager(
                        sims4.resources.Types.INTERACTION),
                    class_restrictions=('SuperInteraction', ))))
    }


(TunableTempleRoomData, _) = define_snippet('TempleRoomData',
                                            TempleRoomData.TunableFactory())
Esempio n. 12
0
 def _SetupSnippet(cls) -> None:
     snippets.define_snippet(cls._snippetName, cls._GetSnippetTemplate())
     MainSnippets.SetupSnippetScanning(cls._snippetName,
                                       cls._SnippetTuningCallback)
Esempio n. 13
0
            (f.weight.get_multiplier(resolver), f.fish)
            for f in self.possible_fish
            if f.fish.cls.can_catch(resolver, require_bait=require_bait)
        ]
        if weighted_fish:
            return sims4.random.weighted_random_item(weighted_fish)

    def choose_treasure(self, resolver):
        weighted_treasures = [(t.weight.get_multiplier(resolver), t.treasure)
                              for t in self.possible_treasures]
        if weighted_treasures:
            return sims4.random.weighted_random_item(weighted_treasures)


(TunableFishingDataReference,
 TunableFishingDataSnippet) = define_snippet('fishing_data',
                                             FishingData.TunableFactory())


class FishingBait(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        'bait_name':
        TunableLocalizedStringFactory(
            description='\n            Name of fishing bait.\n            '),
        'bait_description':
        TunableLocalizedStringFactory(
            description=
            '\n            Description of fishing bait.\n            '),
        'bait_icon_definition':
        TunableReference(
            description=
            '\n            Object definition that will be used to render icon of fishing bait.\n            ',
Esempio n. 14
0
from sims4.tuning.tunable import HasTunableSingletonFactory, AutoFactoryInit, TunableList, OptionalTunable, TunableMapping
from snippets import define_snippet
from world.region import Region
import services


class LocationBasedFilterTerms(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        'default_filter_terms':
        OptionalTunable(
            description=
            '\n            Default filter terms to use if the current region is not specified.\n            ',
            tunable=TunableList(tunable=FilterTermVariant()),
            disabled_value=()),
        'region_to_filter_terms':
        TunableMapping(
            description=
            '\n            A mapping of region to filter terms.\n            ',
            key_type=Region.TunableReference(pack_safe=True),
            value_type=TunableList(tunable=FilterTermVariant()))
    }

    def get_filter_terms(self):
        region = services.current_region()
        if region in self.region_to_filter_terms:
            return self.region_to_filter_terms[region]
        return self.default_filter_terms


(_, TunableLocationBasedFilterTermsSnippet) = define_snippet(
    'location_based_filter_terms', LocationBasedFilterTerms.TunableFactory())
            '\n            The interaction to run when firing this type of employee via the UI.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.INTERACTION)),
        'interaction_promote':
        TunablePackSafeReference(
            description=
            '\n            The interaction to run when promoting this type of employee via the UI.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.INTERACTION)),
        'interaction_demote':
        TunablePackSafeReference(
            description=
            '\n            The interaction to run when demoting this type of employee via the UI.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.INTERACTION)),
        'job_name':
        TunableLocalizedString(
            description=
            '\n            The name of this business job.\n            ',
            tuning_group=GroupNames.UI),
        'job_icon':
        TunableResourceKey(
            description=
            '\n            The icon for this business job.\n            ',
            resource_types=sims4.resources.CompoundTypes.IMAGE,
            tuning_group=GroupNames.UI)
    }


(_, TunableBusinessEmployeeDataSnippet) = define_snippet(
    'BusinessEmployeeData', BusinessEmployeeData.TunableFactory())
Esempio n. 16
0
            '\n            A tunable list of test sets and associated multipliers to apply to\n            the total cost of this payment.\n            '
        )
    }

    def get_simoleon_delta(self, resolver, override_amount=None):
        (amount, fund_source) = self.payment_cost.get_simoleon_delta(
            resolver, self.payment_source, self.cost_modifiers)
        if self.payment_source.require_full_amount:
            return (amount, fund_source)
        else:
            return (0, fund_source)

    def try_deduct_payment(self, resolver, sim, fail_callback=None):
        success = self.payment_cost.try_deduct_payment(resolver, sim,
                                                       fail_callback,
                                                       self.payment_source,
                                                       self.cost_modifiers)
        if not success and fail_callback:
            fail_callback()
        return success

    def get_cost_string(self):
        return self.payment_source.get_cost_string()

    def get_gain_string(self):
        return self.payment_source.get_gain_string()


(TunablePaymentReference,
 TunablePaymentSnippet) = define_snippet('payment', Payment.TunableFactory())
    def __repr__(self):
        conditions = []
        for condition in self.conditions:
            if callable(condition) and not isinstance(condition, TunableFactory.TunableFactoryWrapper):
                conditions.append(callable_repr(condition))
            else:
                conditions.append(condition)
        kwargs = {}
        if self.tests is not None:
            kwargs['tests'] = self.tests
        kwargs['restrictions'] = self.restrictions
        kwargs['interaction_action'] = self.interaction_action
        kwargs['progress_bar_action'] = self.progress_bar_action
        return standard_repr(self, conditions, **kwargs)

(_, TunableExitConditionSnippet) = snippets.define_snippet('exit_condition', ExitCondition.TunableFactory(), use_list_reference=True)

class TunableStatisticIncrementDecrement(TunableFactory):
    __qualname__ = 'TunableStatisticIncrementDecrement'

    @staticmethod
    def _factory(interaction, stat, subject, amount, sequence=None):
        target = interaction.get_participant(subject)
        if target is not None:
            tracker = target.get_tracker(stat)

            def begin(_):
                tracker.add_value(stat, amount)

            def end(_):
                tracker.add_value(stat, -amount)
Esempio n. 18
0
import snippets
logger = sims4.log.Logger('Fishing', default_owner='TrevorLindsey')

class FishingData(sims4.tuning.tunable.HasTunableSingletonFactory, sims4.tuning.tunable.AutoFactoryInit):
    __qualname__ = 'FishingData'
    FACTORY_TUNABLES = {'weight_fish': sims4.tuning.tunable.Tunable(description='\n            The weight used to determine if the Sim will catch a fish instead of treasure or junk..\n            This will be used in conjunction with the Weight Junk and Weight Treasure.\n            ', tunable_type=float, default=1.0), 'weight_junk': sims4.tuning.tunable.Tunable(description='\n            The weight used to determine if the Sim will catch junk instead of a fish or treasure.\n            This will be used in conjunction with the Weight Fish and Weight Treasure.\n            ', tunable_type=float, default=1.0), 'weight_treasure': sims4.tuning.tunable.Tunable(description='\n            The weight used to determine if the Sim will catch a treasure instead of fish or junk.\n            This will be used in conjunction with the Weight Fish and Weight Junk.\n            ', tunable_type=float, default=1.0), 'possible_treasures': sims4.tuning.tunable.TunableList(description="\n            If the Sim catches a treasure, we'll pick one of these based on their weights.\n            Higher weighted treasures have a higher chance of being caught.\n            ", tunable=sims4.tuning.tunable.TunableTuple(treasure=sims4.tuning.tunable.TunableReference(manager=services.definition_manager()), weight=sims4.tuning.tunable.Tunable(tunable_type=float, default=1.0))), 'possible_fish': sims4.tuning.tunable.TunableList(description="\n            If the Sim catches a fish, we'll pick one of these based on their weights.\n            Higher weighted fish have a higher chance of being caught.\n            ", tunable=sims4.tuning.tunable.TunableTuple(fish=sims4.tuning.tunable.TunableReference(manager=services.definition_manager()), weight=sims4.tuning.tunable.Tunable(tunable_type=float, default=1.0)))}

    def _verify_tuning_callback(self):
        import fishing.fish_object
        if not self.possible_fish:
            logger.error("FishingData has an empty list of Possible Fish. This isn't much of a fishing location if there aren't any fish.\n{}", self)
        else:
            for fish in self.possible_fish:
                while fish.fish is None or not issubclass(fish.fish.cls, fishing.fish_object.Fish):
                    logger.error("Possible Fish on Fishing Data has been tuned but there either isn't a definition tuned for the fish, or the definition currently tuned is not a Fish.\n{}", self)

    def get_possible_fish_gen(self):
        yield self.possible_fish

    def choose_fish(self, resolver):
        weighted_fish = [(f.weight, f.fish) for f in self.possible_fish if f.fish.cls.can_catch(resolver, require_bait=True)]
        if weighted_fish:
            return sims4.random.weighted_random_item(weighted_fish)

    def choose_treasure(self):
        weighted_treasures = [(t.weight, t.treasure) for t in self.possible_treasures]
        if weighted_treasures:
            return sims4.random.weighted_random_item(weighted_treasures)

(_, TunableFishingDataSnippet) = snippets.define_snippet('fishing_data', FishingData.TunableFactory())
Esempio n. 19
0
            '\n            Tests which would dictate if this option is enabled\n            in the pie menu.  ORs of ANDs.\n            \n            If disabled, it will default to the tests for the\n            first affordance in the continuation chain.\n            ',
            tunable=TunableTestSet()),
        'localization_tokens':
        OptionalTunable(
            description=
            "\n            Additional localization tokens for this item\n            to use in the name/description.\n            \n            This is in addition to the display name tokens\n            tuned in the continuation's first affordance.\n            ",
            tunable=LocalizationTokens.TunableFactory()),
        'visibility_tests':
        OptionalTunable(
            description=
            '\n            Tests which would dictate if this option is visible\n            in the pie menu.  ORs of ANDs.\n            \n            If disabled, this item will always be visible.\n            ',
            tunable=TunableTestSet())
    }


(_, TunableInteractionPickerItemSnippet) = define_snippet(
    'interaction_picker_item', InteractionPickerItem.TunableFactory())


class InteractionPickerSuperInteraction(PickerSuperInteraction):
    INSTANCE_TUNABLES = {
        'picker_dialog':
        UiItemPicker.TunableFactory(
            description='\n            The item picker dialog.\n            ',
            tuning_group=GroupNames.PICKERTUNING),
        'possible_actions':
        TunableList(
            description=
            '\n            A list of the interactions that will show up in the dialog picker\n            ',
            tunable=TunableInteractionPickerItemSnippet(),
            minlength=1,
            tuning_group=GroupNames.PICKERTUNING)
Esempio n. 20
0
from sims.outfits.outfit_utils import OutfitGeneratorRandomizationMixin
from sims4.tuning.tunable import AutoFactoryInit, HasTunableSingletonFactory, TunableSet, TunableEnumWithFilter
from snippets import define_snippet
from tag import Tag


class OutfitGenerator(OutfitGeneratorRandomizationMixin,
                      HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        'tags':
        TunableSet(
            description=
            '\n            The set of tags used to generate the outfit. Parts must match the\n            specified tag in order to be valid for the generated outfit.\n            ',
            tunable=TunableEnumWithFilter(
                tunable_type=Tag,
                filter_prefixes=('Uniform', 'OutfitCategory', 'Style',
                                 'Situation'),
                default=Tag.INVALID,
                invalid_enums=(Tag.INVALID, ),
                pack_safe=True))
    }

    def __call__(self, *args, **kwargs):
        self._generate_outfit(*args, tag_list=self.tags, **kwargs)


(TunableOutfitGeneratorReference,
 TunableOutfitGeneratorSnippet) = define_snippet(
     'Outfit', OutfitGenerator.TunableFactory())
Esempio n. 21
0
    FACTORY_TUNABLES = {
        'looping_audio':
        TunableResourceKey(
            description=
            '\n            The looping propx file of the music track.\n            ',
            resource_types=(Types.PROPX, )),
        'fixed_length_audio':
        TunableResourceKey(
            description=
            '\n            The fixed-length propx file of the music track.\n            ',
            resource_types=(Types.PROPX, ))
    }


(TunableMusicTrackDataReference,
 TunableMusicTrackDataSnippet) = define_snippet(
     MUSIC_TRACK_DATA, MusicTrackData.TunableFactory())


class UseMusicProductionStationSuperInteraction(SuperInteraction):
    INSTANCE_TUNABLES = {
        'music_track_data_snippet':
        TunableMusicTrackDataSnippet(
            description=
            '\n            The reference to looping and fixed-length .propx files for the associated\n            music track.\n            '
        ),
        'channels':
        TunableMapping(
            description=
            '\n            A map of channel enums and their associated data. \n            ',
            key_type=TunableEnumEntry(
                description=
Esempio n. 22
0
            result = finish_action.availability_tests.run_tests(resolver)
            if not result:
                if finish_action.disabled_text is not None:
                    disabled_text = finish_action.disabled_text if not result else None
                    responses.append(UiDialogResponse(dialog_response_id=action_id, text=self._get_action_display_text(finish_action), subtext=self._interaction.create_localized_string(finish_action.display_subtext), disabled_text=disabled_text() if disabled_text is not None else None))
            disabled_text = finish_action.disabled_text if not result else None
            responses.append(UiDialogResponse(dialog_response_id=action_id, text=self._get_action_display_text(finish_action), subtext=self._interaction.create_localized_string(finish_action.display_subtext), disabled_text=disabled_text() if disabled_text is not None else None))
        if not responses:
            return
        if False and _show_all_adventure_moments:
            responses.extend(self._parent_adventure.get_cheat_responses(action_id))
        dialog.set_responses(responses)
        dialog.add_listener(self._on_dialog_response)
        return dialog

(TunableAdventureMomentReference, TunableAdventureMomentSnippet) = define_snippet('Adventure_Moment', AdventureMoment.TunableFactory())

class Adventure(XevtTriggeredElement, HasTunableFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {'description': '\n            A series of individual moments linked together in a game-like\n            fashion.\n            ', '_adventure_moments': TunableMapping(description='\n            The individual adventure moments for this adventure. Every moment\n            used in the adventure must be defined here. For instance, if there\n            is an adventure moment that triggers another adventure moment, the\n            latter must also be defined in this list.\n            ', key_type=AdventureMomentKey, value_type=TunableTuple(aventure_moment=TunableAdventureMomentSnippet(pack_safe=True), sim_specific_cooldown=TunableVariant(description='\n                    The type of sim specific cooldown,\n                    \n                    Hours means cooldown for specified number of sim hours\n                    No cooldown means no cooldown\n                    One shot means a sim will only see it once.\n                    \n                    (Note:  If we hit a visible (or resumed) adventure, after\n                    that point if all actions are on cooldown, the cooldowns will be\n                    ignored.)\n                    ', hours=TunableRange(description='\n                        A cooldown that last for the specified number of hours\n                        ', tunable_type=float, default=50, minimum=1), locked_args={'one_shot': DATE_AND_TIME_ZERO, 'no_cooldown': None}, default='no_cooldown'))), '_initial_moments': TunableList(description='\n            A list of adventure moments that are valid as initiating moments for\n            this adventure.\n            ', tunable=TunableTuple(description='\n                A tuple of moment key and weight. The higher the weight, the\n                more likely it is this moment will be selected as the initial\n                moment.\n                ', adventure_moment_key=TunableEnumEntry(description='\n                    The key of the initial adventure moment.\n                    ', tunable_type=AdventureMomentKey, default=AdventureMomentKey.INVALID), weight=TunableMultiplier.TunableFactory(description='\n                    The weight of this potential initial moment relative\n                    to other items within this list.\n                    '))), '_trigger_interval': TunableInterval(description='\n            The interval, in Sim minutes, between the end of one adventure\n            moment and the beginning of the next one.\n            ', tunable_type=float, default_lower=8, default_upper=12, minimum=0), '_maximum_triggers': Tunable(description='\n            The maximum number of adventure moments that can be triggered by\n            this adventure. Any moment being generated from the adventure beyond\n            this limit will be discarded. Set to 0 to allow for an unlimited\n            number of adventure moments to be triggered.\n            ', tunable_type=int, default=0), '_resumable': Tunable(description='\n            A Sim who enters a resumable adventure will restart the same\n            adventure at the moment they left it at.\n            ', tunable_type=bool, default=True)}

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._adventure_moment_count = 0
        self._alarm_handle = None
        self._current_moment_key = None
        self._canceled = False
        self.force_action_result = False

    def _build_outer_elements(self, sequence):
        return build_critical_section_with_finally(sequence, self._end_adventure)
        self._triggers = []
        index = 0
        for effect_trigger in triggers:
            for trigger in effect_trigger.triggers:
                self._triggers.append(
                    trigger(self, index, effect_trigger.effect))
                index += 1

    def on_activate(self, reader=None):
        super().on_activate(reader)
        for (job, role_state) in self._job_and_role_changes.items():
            self.owner._set_job_role_state(job, role_state)
        for trigger_data in self._triggers:
            trigger_data.on_activate(reader)

    def on_deactivate(self):
        super().on_deactivate()
        for trigger_data in self._triggers:
            trigger_data.destroy()
        self._triggers.clear()

    def save_state(self, writer):
        super().save_state(writer)
        for trigger_data in self._triggers:
            trigger_data.save(writer)


(TunableCustomStatesSituationStateReference,
 TunableCustomStatesSituationStateSnippet) = define_snippet(
     CUSTOM_STATES_SITUATION_STATE,
     CustomStatesSituationState.TunableFactory())
Esempio n. 24
0
        msg.type = ScreenSlamType.CUSTOM
        msg.ui_key = self.key

class ScreenSlamDisplayVariant(TunableVariant):

    def __init__(self, **kwargs):
        super().__init__(size_based=ScreenSlamSizeBased.TunableFactory(), key_based=ScreenSlamKeyBased.TunableFactory(), default='size_based', **kwargs)

class ScreenSlam(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {'display_type': ScreenSlamDisplayVariant(), 'title': OptionalTunable(description='\n            Title of the screen slam.\n            ', tunable=TunableLocalizedStringFactory()), 'text': OptionalTunable(description='"\n            Text of the screen slam.\n            ', tunable=TunableLocalizedStringFactory()), 'icon': OptionalTunable(description=',\n            Icon to be displayed for the screen Slam.\n            ', tunable=TunableIcon()), 'audio_sting': OptionalTunable(description='\n            A sting to play at the same time as the screen slam.\n            ***Some screen slams may appear to play a sting, but the audio is\n            actually tuned on something else.  Example: On CareerLevel tuning\n            there already is a tunable, Promotion Audio Sting, to trigger a\n            sting, so one is not necessary on the screen slam.  Make sure to\n            avoid having to stings play simultaneously.***\n            ', tunable=TunablePlayAudio()), 'active_sim_only': Tunable(description='\n            If true, the screen slam will be only be shown if the active Sim\n            triggers it.\n            ', tunable_type=bool, default=True)}

    def send_screen_slam_message(self, sim_info, *localization_tokens):
        msg = protocolbuffers.UI_pb2.UiScreenSlam()
        self.display_type.populate_screenslam_message(msg)
        if self.text is not None:
            msg.name = self.text(*(token for token in itertools.chain(localization_tokens)))
        if sim_info is not None:
            msg.sim_id = sim_info.sim_id
        if self.icon is not None:
            msg.icon.group = self.icon.group
            msg.icon.instance = self.icon.instance
            msg.icon.type = self.icon.type
        if self.title is not None:
            msg.title = self.title(*(token for token in itertools.chain(localization_tokens)))
        if self.active_sim_only and sim_info is not None and sim_info.is_selected or not self.active_sim_only:
            distributor.shared_messages.add_message_if_player_controlled_sim(sim_info, protocolbuffers.Consts_pb2.MSG_UI_SCREEN_SLAM, msg, False)
            if self.audio_sting is not None:
                play_tunable_audio(self.audio_sting)

(TunableScreenSlamReference, TunableScreenSlamSnippet) = define_snippet(SCREEN_SLAM, ScreenSlam.TunableFactory())
Esempio n. 25
0
        for condition in self.conditions:
            if callable(condition) and not isinstance(
                    condition, TunableFactory.TunableFactoryWrapper):
                conditions.append(callable_repr(condition))
            else:
                conditions.append(condition)
        kwargs = {}
        if self.tests is not None:
            kwargs['tests'] = self.tests
        kwargs['restrictions'] = self.restrictions
        kwargs['interaction_action'] = self.interaction_action
        kwargs['progress_bar_action'] = self.progress_bar_action
        return standard_repr(self, conditions, **kwargs)


(_, TunableExitConditionSnippet) = snippets.define_snippet(
    'exit_condition', ExitCondition.TunableFactory(), use_list_reference=True)


class TunableStatisticIncrementDecrement(TunableFactory):
    @staticmethod
    def _factory(interaction, stat, subject, amount, sequence=None):
        target = interaction.get_participant(subject)
        if target is not None:
            tracker = target.get_tracker(stat)

            def begin(_):
                tracker.add_value(stat, amount)

            def end(_):
                tracker.add_value(stat, -amount)
Esempio n. 26
0
                float,
                0.01,
                description=
                'The LOS origin is allowed to be outside of the boundary by this amount.'
            ),
            facing_offset=Tunable(
                float,
                0.1,
                description=
                'The LOS origin is offset from the object origin by this amount (mainly to avoid intersecting walls).'
            ),
            description=description,
            **kwargs)


(_, TunablePrivacySnippet) = snippets.define_snippet('Privacy',
                                                     TunablePrivacy())
SHOO_LIABILITY = 'ShooLiability'


class ShooLiability(Liability):
    __qualname__ = 'ShooLiability'

    def __init__(self, privacy, sim):
        self._privacy = privacy
        self._sim = sim

    def release(self):
        if self._privacy.is_active:
            if self._sim in self._privacy.find_violating_sims():
                self._privacy.interaction.cancel(
                    FinishingType.LIABILITY,
Esempio n. 27
0
	FACTORY_TUNABLES = {
		'command': Tunable(description = 'The command.', tunable_type = str, default = ''),
		'arguments': TunableList(description = '\n            The arguments for this command. Arguments will be added after the\n            command.\n            ', tunable = TunableVariant(description = '\n                An argument being passed to the command.\n                ', boolean = TunableTuple(description = '\n                    A boolean value.\n                    ', arg_value = Tunable(tunable_type = bool, default = False), locked_args = {
			'arg_type': CommandArgType.ARG_TYPE_BOOL
		}), string = TunableTuple(description = '\n                    A string.\n                    ', arg_value = Tunable(tunable_type = str, default = ''), locked_args = {
			'arg_type': CommandArgType.ARG_TYPE_STRING
		}), floating_point = TunableTuple(description = '\n                    A floating point number.\n                    ', arg_value = Tunable(tunable_type = float, default = 0.0), locked_args = {
			'arg_type': CommandArgType.ARG_TYPE_FLOAT
		}), integer = TunableTuple(description = '\n                    An integer number.\n                    ', arg_value = Tunable(tunable_type = int, default = 0), locked_args = {
			'arg_type': CommandArgType.ARG_TYPE_INT
		}), participant_id = UiResponseParticipantId.TunableFactory(), special_command_data = TunableTuple(description = '\n                    This will use the data passed into the show_dialog()\n                    function. This must be supported with GPE work, so\n                    only use this if you have talked to a GPE.\n                    ', locked_args = {
			'arg_type': CommandArgType.ARG_TYPE_SPECIAL
		})))
	}

(_, TunableUiResponseCommandSnippet) = define_snippet('u_i_response_command', _UiResponseCommand.TunableFactory())

class UiDialogResponse(HasTunableSingletonFactory, AutoFactoryInit):
	class UiDialogUiRequest(enum.Int):
		NO_REQUEST = 0
		SHOW_LESSONS = 1
		SHOW_ACHIEVEMENTS = 2
		SHOW_GALLERY = 3
		SHOW_FAMILY_INVENTORY = 4
		SHOW_SKILL_PANEL = 5
		SHOW_SUMMARY_PANEL = 6
		SHOW_ASPIRATION_PANEL = 7
		SHOW_ASPIRATION_UI = 8
		SHOW_EVENT_UI = 9
		SHOW_CAREER_PANEL = 10
		SHOW_RELATIONSHIP_PANEL = 11
Esempio n. 28
0
def _Setup():
    global IdentifiersSnippetReference, IdentifiersSnippet
    IdentifiersSnippetReference, IdentifiersSnippet = snippets.define_snippet(
        IdentifiersSnippetName, IdentifiersTemplate)
Esempio n. 29
0
import sims4.log
TRANSITION_POSTURE_PARAM_NAME = 'transitionPosture'
logger = sims4.log.Logger('Postures')

class PosturePreconditions(enum.IntFlags):
    __qualname__ = 'PosturePreconditions'
    NONE = 0
    SAME_TARGET = 1

class PostureSupportInfo(TunableTuple):
    __qualname__ = 'PostureSupportInfo'

    def __init__(self, **kwargs):
        super().__init__(posture_type=TunableReference(services.posture_manager(), description='Posture that is supported by this object.'), required_clearance=OptionalTunable(Tunable(float, 1, description='Amount of clearance you need in front of the object or part for this posture to be supported.')), **kwargs)

(TunablePostureTypeListReference, TunablePostureTypeListSnippet) = define_snippet(POSTURE_TYPE_LIST, TunableList(PostureSupportInfo(), description='\n                                        A list of postures this object supports and any information about how\n                                        that posture can be used on the object in game.\n                                        '))

@unique_id('id')
class Posture(metaclass=TunedInstanceMetaclass, manager=services.posture_manager()):
    __qualname__ = 'Posture'
    ASM_SOURCE = '_asm_key'
    INSTANCE_TUNABLES = {'mobile': Tunable(bool, False, tuning_filter=FilterTag.EXPERT_MODE, description='If True, the Sim can route in this posture.'), 'unconstrained': Tunable(bool, False, description='If True, the Sim can stand anywhere in this posture.'), 'ownable': Tunable(bool, True, description="If True, This posture is ownable by interactions. Ex: A posture like carry_nothing should not be ownable, because it will cause strange cancelations that don't make sense."), 'social_geometry': TunableTuple(social_space=TunablePolygon(description="\n             The special geometry override for socialization in this posture. This defines\n             where the Sim's attention is focused and informs the social positioning system where\n             each Sim should stand to look most natural when interacting with this Sim. \n             Ex: we override the social geometry for a Sim who is bartending to be a wider cone \n             and be in front of the bar instead of embedded within the bar. This encourages Sims \n             to stand on the customer-side of the bar to socialize with this Sim instead of coming \n             around the back."), focal_point=TunableVector3(sims4.math.Vector3.ZERO(), description='Focal point when socializing in this posture, relative to Sim'), tuning_filter=FilterTag.EXPERT_MODE, description='The special geometry for socialization in this posture.'), ASM_SOURCE: TunableResourceKey(None, [sims4.resources.Types.STATEMACHINE], tuning_group=GroupNames.ANIMATION, description='The posture ASM.', category='asm'), '_actor_param_name': Tunable(str, 'x', source_location=ASM_SOURCE, source_query=SourceQueries.ASMActorSim, tuning_group=GroupNames.ANIMATION, description="\n             The name of the actor parameter in this posture's ASM. By default, this is x, and you should probably\n             not change it."), '_target_name': Tunable(str, None, source_location=ASM_SOURCE, source_query=SourceQueries.ASMActorAll, tuning_group=GroupNames.ANIMATION, description="\n             The actor name for the target object of this posture. Leave empty for postures with no target. \n             In the case of a posture that targets an object, it should be the name of the object actor in \n             this posture's ASM. \n             ."), '_enter_state_name': Tunable(str, None, source_location=ASM_SOURCE, source_query=SourceQueries.ASMState, tuning_group=GroupNames.ANIMATION, description='\n             The name of the entry state for the posture in the ASM. \n             All postures should have two public states, not including entry and exit.\n             This should be the first of the two states.'), '_exit_state_name': Tunable(str, 'exit', source_location=ASM_SOURCE, source_query=SourceQueries.ASMState, tuning_group=GroupNames.ANIMATION, description='\n             The name of the exit state in the ASM. By default, this is exit.'), '_state_name': Tunable(str, None, source_location=ASM_SOURCE, source_query=SourceQueries.ASMState, tuning_group=GroupNames.ANIMATION, description='\n             The main state name for the looping posture pose in the ASM.\n             All postures should have two public states, not including entry and exit.\n             This should be the second of the two states.'), '_supported_postures': TunableList(TunableTuple(posture_type=TunableReference(services.posture_manager(), description='A supported posture.'), entry=Tunable(bool, True, description=''), exit=Tunable(bool, True, description=''), transition_cost=OptionalTunable(Tunable(float, 1, description="Cost of the transition to this posture then calculating the Sim's transition sequence.")), preconditions=TunableEnumFlags(PosturePreconditions, PosturePreconditions.NONE), description='A list of postures that this posture supports entrance from and exit to. Defaults to [stand]')), '_supports_carry': Tunable(description='\n            Whether or not there should be a carry version of this posture in\n            the posture graph.\n            ', tunable_type=bool, default=True), 'censor_level': TunableEnumEntry(CensorState, None, tuning_filter=FilterTag.EXPERT_MODE, description="\n                                                                                The type of censor grid that will be applied to any Sim in this posture.  \n                                                                                A censor grid obscures different parts of a Sim's body depending on what censor level it is set at.  \n                                                                                For example, the LHAND censor level will obscure a Sim's left hand.  \n                                                                                By default, postures have no censor level association, which means no censor grid will be applied to them \n                                                                                and every part of their body will be visible when in this posture.\n                                                                                "), 'outfit_change': TunableOutfitChange(description='\n            Define what outfits the Sim is supposed to wear when entering or\n            exiting this posture.\n            '), 'cost': Tunable(float, 0, description='( >= 0 ) The distance a sim is willing to pay to avoid using this posture (higher number discourage using the posture)'), 'idle_animation': TunableAnimationReference(callback=None, tuning_group=GroupNames.ANIMATION, description='The animation for a Sim to play while in this posture and waiting for interaction behavior to start.'), 'jig': OptionalTunable(TunableReference(manager=services.definition_manager(), description='The jig to place while the Sim is in this posture.'), description='An optional Jig to place while the Sim is in this posture.'), 'allow_affinity': Tunable(bool, True, description="\n                            If True, Sims will prefer to use this posture if someone\n                            they're interacting with is using the posture.\n                            \n                            Ex: If you chat with a sitting sim, you will prefer to\n                            sit with them and chat.\n                            "), 'additional_put_down_distance': Tunable(description="\n            An additional distance in front of the Sim to start searching for\n            valid put down locations when in this posture.\n            \n            This tunable is only respected for the Sim's body posture.\n            ", tunable_type=float, default=0.5), 'additional_interaction_jig_fgl_distance': Tunable(description='\n            An additional distance (in meters) in front of the Sim to start \n            searching when using FGL to place a Jig to run an interaction.', tunable_type=float, default=0)}
    DEFAULT_POSTURE = TunableReference(services.get_instance_manager(sims4.resources.Types.POSTURE), description="The default affordance to use as the supported posture if nothing is tuned in a Posture's 'Supported Postures'")
    IS_BODY_POSTURE = True

    def test(self):
        return True

    @classproperty
    def target_name(cls):
        return cls._target_name
Esempio n. 30
0
def _Setup () -> None:
	snippets.define_snippet(_woohooSafetyMethodSnippetName, WoohooSafetyMethod.TunableFactory())
	MainSnippets.SetupSnippetScanning(_woohooSafetyMethodSnippetName, _WoohooSafetyMethodsScanningCallback)

	snippets.define_snippet(_limitedUseWoohooSafetyMethodSnippetName, LimitedUseWoohooSafetyMethod.TunableFactory())
	MainSnippets.SetupSnippetScanning(_limitedUseWoohooSafetyMethodSnippetName, _WoohooSafetyMethodsScanningCallback)
Esempio n. 31
0
        elif prescribed_weather_type.blizzard and (
                not snow_safe or options[PrecipitationType.SNOW]
                == WeatherOption.DISABLE_STORMS):
            return False
        return True


(
    TunableWeatherForecastListReference, TunableWeatherForecastListSnippet
) = define_snippet(
    'weather_forcast_list',
    TunableList(tunable=TunableTuple(
        description=
        '\n            A tuple of forecast and weight.\n            ',
        forecast=WeatherForecast.TunableReference(
            description=
            '\n                The weather forecast.\n                ',
            pack_safe=True),
        weight=Tunable(
            description=
            '\n                Weight of this forecast being selected.\n                ',
            tunable_type=int,
            default=1))))
(
    TunableWeatherSeasonalForecastsReference,
    TunableWeatherSeasonalForecastsSnippet
) = define_snippet(
    'weather_seasonal_forecasts',
    TunableMapping(
        key_type=TunableEnumEntry(
            description='\n            The part of the season.\n            ',
            tunable_type=SeasonSegment,