コード例 #1
0
from animation.posture_manifest import AnimationParticipant
from sims4.log import Logger
from sims4.math import MAX_UINT32
from sims4.tuning.dynamic_enum import DynamicEnumFlags, DynamicEnum
import enum
import postures.posture_specs
logger = Logger('Interactions')


class PipelineProgress(enum.Int, export=False):
    __qualname__ = 'PipelineProgress'
    NONE = 0
    QUEUED = 1
    PRE_TRANSITIONING = 2
    PREPARED = 3
    RUNNING = 4
    STAGED = 5
    EXITED = 6


class TargetType(enum.IntFlags):
    __qualname__ = 'TargetType'
    ACTOR = 1
    TARGET = 2
    GROUP = 4
    OBJECT = 8
    TARGET_AND_GROUP = TARGET | GROUP


class ParticipantType(enum.IntFlags):
    __qualname__ = 'ParticipantType'
import operator
import random
from gsi_handlers.relationship_culling_handlers import RelationshipGSIData
from objects import ALL_HIDDEN_REASONS
from sims4.log import Logger
from sims4.tuning.tunable import Tunable, TunableTuple
from story_progression.story_progression_action import _StoryProgressionAction
from tunable_time import TunableTimeOfDay
import gsi_handlers
import performance
import services
import sims4
import telemetry_helper

logger = Logger('RelationshipCulling', default_owner='johnwilkinson')
TELEMETRY_GROUP_STORY_PROGRESSION = 'STRY'
TELEMETRY_HOOK_CULL_REL_BEFORE = 'CRBF'
TELEMETRY_HOOK_CULL_REL_AFTER = 'CRAF'
writer = sims4.telemetry.TelemetryWriter(TELEMETRY_GROUP_STORY_PROGRESSION)


class StoryProgressionRelationshipCulling(_StoryProgressionAction):
    PLAYED_NPC_TO_PLAYED_NPC_MAX_RELATIONSHIPS = Tunable(
        description=
        '\n        The max number of relationships that a played NPC is allowed to have\n        with other NPCs. This is for sims that have been played in the past,\n        but are not part of the active household now, and only operates on\n        relationships with other NPCs.\n        ',
        tunable_type=int,
        default=20)
    CULLING_BUFFER_AMOUNT = Tunable(
        description=
        '\n        When relationships are culled from an NPC relationship tracker due to \n        the number of relationships exceeding the cap, this is how much below\n        the cap the number of relationships will be after the culling.\n        ',
        tunable_type=int,
コード例 #3
0
from event_testing.resolver import SingleSimResolver
from familiars.familiar_enums import FamiliarType
from interactions import ParticipantTypeSingle
from interactions.utils.interaction_elements import XevtTriggeredElement
from sims.sim_info_types import Species
from sims4.log import Logger
from sims4.tuning.tunable import HasTunableFactory, AutoFactoryInit, TunableEnumEntry, HasTunableSingletonFactory, TunableVariant
from ui.ui_dialog_generic import UiDialogTextInputOk
from ui.ui_dialog_notification import UiDialogNotification
logger = Logger('Familiars', default_owner='jjacobson')


class BindPetFamiliar(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        'participant':
        TunableEnumEntry(
            description=
            '\n            The Participant to Bind as a Familiar to the Sim.\n            ',
            tunable_type=ParticipantTypeSingle,
            default=ParticipantTypeSingle.TargetSim),
        'bound_familiar_tns':
        UiDialogNotification.TunableFactory(
            description=
            '\n            TNS that is displayed when this pet is bound as a familiar.\n            '
        )
    }

    def bind_familiar(self, interaction, familiar_owner, familiar_tracker):
        familiar = interaction.get_participant(self.participant)
        if familiar.species == Species.CAT:
            familiar_type = FamiliarType.CAT
コード例 #4
0
ファイル: example.py プロジェクト: NeonOcean/Environment
from sims4.tuning.tunable import Tunable, TunableFactory
from objects.components import Component, componentmethod
from sims4.log import Logger
from objects.components.types import EXAMPLE_COMPONENT

logger = Logger('ExampleComponent')


class ExampleComponent(Component, component_name=EXAMPLE_COMPONENT):
    def __init__(self, owner, example_name):
        super().__init__(owner)
        self.example_name = example_name

    @componentmethod
    def example_component_method(self, prefix=''):
        logger.warn('{}self={} owner={} example_name={}', prefix, self,
                    self.owner, self.example_name)

    def on_location_changed(self, old_location):
        self.example_component_method('on_location_changed: ')


class TunableExampleComponent(TunableFactory):
    FACTORY_TYPE = ExampleComponent

    def __init__(self,
                 description='Example component, do not use on objects!',
                 callback=None,
                 **kwargs):
        super().__init__(example_name=Tunable(
            str,
コード例 #5
0
import services
from event_testing.results import TestResult
from event_testing.test_base import BaseTest
from interactions import ParticipantType, ParticipantTypeObject
from objects.components.types import CRAFTING_COMPONENT
from sims4.log import Logger
from sims4.resources import Types
from sims4.tuning.tunable import HasTunableSingletonFactory, AutoFactoryInit, TunableVariant, TunableReference, TunableSet, OptionalTunable, TunableEnumEntry
from tag import TunableTag
logger = Logger('Crafting_Tests')


class _TestRecipeByTag(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        'required_tag':
        TunableTag(
            description=
            '\n            The tag that must exist on the recipe\n            ',
            filter_prefixes=('Recipe', ))
    }

    def test_recipe(self, recipe):
        if self.required_tag not in recipe.recipe_tags:
            return TestResult(
                False,
                f'{recipe} does not have required tag {self.required_tag}')
        return TestResult.TRUE


class _TestRecipeByDefinition(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
コード例 #6
0
from sims4.callback_utils import consume_exceptions
from sims4.log import Logger
from sims4.repr_utils import standard_repr
from sims4.tuning.tunable import Tunable
from singletons import DEFAULT
import animation.posture_manifest
import assertions
import enum
import event_testing
import objects.components.types
import routing
import services
import sims
import sims4.callback_utils
import sims4.reload
logger = Logger('PostureGraph')
BODY_INDEX = 0
CARRY_INDEX = 1
SURFACE_INDEX = 2
BODY_POSTURE_TYPE_INDEX = 0
BODY_TARGET_INDEX = 1
CARRY_POSTURE_TYPE_INDEX = 0
CARRY_TARGET_INDEX = 1
CARRY_HAND_INDEX = 2
SURFACE_TARGET_INDEX = 0
SURFACE_SLOT_TYPE_INDEX = 1
SURFACE_SLOT_TARGET_INDEX = 2
with sims4.reload.protected(globals()):
    _enable_cache_count = 0
    _cached_object_manager = None
    _cached_valid_objects = None
コード例 #7
0
            pass

        @staticmethod
        def list_floor_features(*_, **__):
            pass

        @staticmethod
        def scan_floor_features(*_, **__):
            pass

        @staticmethod
        def get_variant_group_id(*_, **__):
            pass


logger = Logger('BuildBuy')


def remove_object_from_buildbuy_system(obj_id, zone_id, persist=True):
    _buildbuy.remove_object_from_buildbuy_system(obj_id, zone_id, persist)


get_wall_contours = _buildbuy.get_wall_contours
add_object_to_buildbuy_system = _buildbuy.add_object_to_buildbuy_system
invalidate_object_location = _buildbuy.invalidate_object_location
get_stair_count = _buildbuy.get_stair_count
update_object_attributes = _buildbuy.update_object_attributes
test_location_for_object = _buildbuy.test_location_for_object
has_floor_at_location = _buildbuy.has_floor_at_location
is_location_outside = _buildbuy.is_location_outside
is_location_natural_ground = _buildbuy.is_location_natural_ground
コード例 #8
0
from sims4.tuning.tunable import TunableRange, Tunable, TunableInterval, TunableAngle, OptionalTunable
from sims4.tuning.tunable_base import GroupNames
from sims4.utils import flexmethod
from singletons import DEFAULT
from socials.jigs.jig_type_explicit import SocialJigExplicit
from socials.jigs.jig_utils import JigPositioning
from terrain import get_water_depth, get_water_depth_at_location
from world.ocean_tuning import OceanTuning
import element_utils
import interactions
import routing
import services
import sims4.geometry
import sims4.math

logger = Logger('DistancePlacementMixin')


class DistancePlacementMixin:
    INSTANCE_TUNABLES = {
        'facing_radius':
        TunableRange(
            description=
            '\n            Facing constraint radius that will be used for the Sim looking \n            at the target position where the object will be placed.\n            ',
            tunable_type=int,
            default=1,
            minimum=1,
            tuning_group=GroupNames.CONSTRAINTS),
        'facing_range':
        TunableAngle(
            description=