def _is_accessible(self, game_object):
     routing_surface = TurboMathUtil.Location.get_location_routing_surface(
         TurboObjectUtil.Position.get_location(game_object))
     position = TurboObjectUtil.Position.get_position(
         game_object) + get_object_fixed_direction(game_object)
     return TurboWorldUtil.Routing.is_position_routable(
         routing_surface, position)
 def _cache_objects(self):
     room_types_count = 0
     room_types = dict()
     for game_object in TurboObjectUtil.GameObject.get_all_gen():
         if TurboTypesUtil.Sims.is_sim(game_object):
             pass
         object_position = TurboObjectUtil.Position.get_position(
             game_object) + get_object_fixed_direction(game_object)
         room_id = TurboWorldUtil.Lot.get_room_id(
             TurboObjectUtil.Position.get_location(game_object),
             position=object_position)
         if room_id != self._id:
             pass
         while not room_id == TurboWorldUtil.Plex.get_active_zone_plex_id():
             if not TurboWorldUtil.Lot.is_position_on_active_lot(
                     TurboObjectUtil.Position.get_position(game_object)):
                 pass
             object_room_types = get_object_association_to_room_type(
                 game_object)
             if object_room_types:
                 for room_type in object_room_types:
                     room_types[
                         room_type] = 1 if room_type not in room_types else room_types[
                             room_type] + 1
                 room_types_count += len(object_room_types)
             self._objects.append(ObjectStructureData(game_object))
     random.shuffle(self._objects)
     for (room_type, types_amount) in room_types.items():
         self._types.append((room_type, types_amount / room_types_count))
def change_player_sex_interaction_location(active_sex_handler,
                                           location_object,
                                           interaction_context=None,
                                           interaction_type=None):
    object_identifier = SexInteractionLocationType.get_location_identifier(
        location_object)
    if TurboTypesUtil.Objects.is_game_object(location_object):
        location_object = TurboObjectUtil.GameObject.get_parent(
            location_object)
        game_object_id = TurboResourceUtil.Resource.get_id(location_object)
        location_position = get_object_fixed_position(location_object)
        location_level = TurboMathUtil.Location.get_location_level(
            TurboObjectUtil.Position.get_location(location_object))
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboObjectUtil.Position.get_location(location_object)))
        location_route_position = TurboObjectUtil.Position.get_position(
            location_object) + get_object_fixed_direction(location_object)
    elif interaction_context is not None:
        game_object_id = -1
        location_position = get_floor_object_position(location_object,
                                                      interaction_context)
        location_level = get_floor_object_level(location_object,
                                                interaction_context)
        location_angle = random.randint(0, 360)
        location_route_position = location_position
    else:
        return
    if interaction_type is not None:
        open_change_sex_location_animations_picker_dialog(
            active_sex_handler, interaction_type, object_identifier,
            game_object_id, 0, location_position.x, location_position.y,
            location_position.z, location_level, location_angle,
            location_route_position.x, location_route_position.y,
            location_route_position.z, location_level)
    else:
        random_animation = get_random_animation(
            object_identifier,
            tuple(active_sex_handler.get_actors_sim_info_gen()))
        if random_animation is None:
            display_ok_dialog(text=2459296019, title=1890248379)
            return
        active_sex_handler.set_animation_instance(random_animation,
                                                  is_manual=True)
        active_sex_handler.set_object_identifier(object_identifier)
        active_sex_handler.set_game_object_id(game_object_id)
        active_sex_handler.set_object_height(0)
        active_sex_handler.set_location(location_position.x,
                                        location_position.y,
                                        location_position.z, location_level,
                                        location_angle)
        active_sex_handler.set_route_position(location_route_position.x,
                                              location_route_position.y,
                                              location_route_position.z,
                                              location_level)
        active_sex_handler.reassign_actors()
        active_sex_handler.restart()
def start_new_npc_sex_interaction(location_object,
                                  interaction_context=None,
                                  interaction_type=None,
                                  is_manual=False):
    location_object = TurboObjectUtil.GameObject.get_parent(location_object)
    location_identifier = SexInteractionLocationType.get_location_identifier(
        location_object)
    if TurboTypesUtil.Objects.is_game_object(location_object):
        game_object_id = TurboResourceUtil.Resource.get_id(location_object)
        location_position = get_object_fixed_position(location_object)
        location_level = TurboMathUtil.Location.get_location_level(
            TurboObjectUtil.Position.get_location(location_object))
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboObjectUtil.Position.get_location(location_object)))
        location_route_position = TurboObjectUtil.Position.get_position(
            location_object) + get_object_fixed_direction(location_object)
    elif interaction_context is not None:
        game_object_id = -1
        location_position = get_floor_object_position(location_object,
                                                      interaction_context)
        location_level = get_floor_object_level(location_object,
                                                interaction_context)
        location_angle = random.randint(0, 360)
        location_route_position = location_position
    else:
        return
    if interaction_type is not None:
        open_sex_npc_sims_picker_dialog(location_position,
                                        interaction_type,
                                        location_identifier,
                                        game_object_id,
                                        0,
                                        TurboWorldUtil.Lot.get_active_lot_id(),
                                        location_position,
                                        location_level,
                                        location_angle,
                                        location_route_position,
                                        location_level,
                                        is_manual=is_manual)
    else:
        open_random_sex_npc_sims_picker_dialog(
            location_position,
            location_identifier,
            game_object_id,
            0,
            TurboWorldUtil.Lot.get_active_lot_id(),
            location_position,
            location_level,
            location_angle,
            location_route_position,
            location_level,
            is_manual=is_manual)
def start_new_direct_sex_interaction(sims_list,
                                     location_object,
                                     animation_instance,
                                     is_autonomy=True):
    creator_sim = TurboManagerUtil.Sim.get_sim_instance(next(iter(sims_list)))
    location_object = TurboObjectUtil.GameObject.get_parent(location_object)
    location_identifier = SexInteractionLocationType.get_location_identifier(
        location_object)
    if TurboTypesUtil.Objects.is_game_object(location_object):
        game_object_id = TurboResourceUtil.Resource.get_id(location_object)
        location_position = get_object_fixed_position(location_object)
        location_level = TurboMathUtil.Location.get_location_level(
            TurboObjectUtil.Position.get_location(location_object))
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboObjectUtil.Position.get_location(location_object)))
        location_route_position = TurboObjectUtil.Position.get_position(
            location_object) + get_object_fixed_direction(location_object)
    elif TurboTypesUtil.Data.is_location(location_object):
        game_object_id = -1
        location_position = TurboMathUtil.Location.get_location_translation(
            location_object)
        location_level = TurboMathUtil.Location.get_location_level(
            location_object)
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboSimUtil.Location.get_location(creator_sim)))
        location_route_position = location_position
    else:
        return False
    pre_sex_handler = PreSexInteractionHandler(
        animation_instance.get_sex_category(),
        TurboManagerUtil.Sim.get_sim_id(creator_sim),
        location_identifier,
        game_object_id,
        0,
        TurboWorldUtil.Lot.get_active_lot_id(),
        location_position.x,
        location_position.y,
        location_position.z,
        location_level,
        location_angle,
        location_route_position.x,
        location_route_position.y,
        location_route_position.z,
        location_level,
        is_autonomy=is_autonomy)
    pre_sex_handler.set_animation_instance(animation_instance)
    for sim in sims_list:
        pre_sex_handler.add_sim(TurboManagerUtil.Sim.get_sim_id(sim))
        sim_ev(sim).active_pre_sex_handler = pre_sex_handler
    return start_sex_interaction_from_pre_sex_handler(pre_sex_handler)
def start_new_player_sex_interaction(sim_identifier,
                                     location_object,
                                     interaction_context=None,
                                     origin_position=None,
                                     interaction_type=None):
    location_object = TurboObjectUtil.GameObject.get_parent(location_object)
    location_identifier = SexInteractionLocationType.get_location_identifier(
        location_object)
    if TurboTypesUtil.Objects.is_game_object(location_object):
        game_object_id = TurboResourceUtil.Resource.get_id(location_object)
        location_position = get_object_fixed_position(location_object)
        location_level = TurboMathUtil.Location.get_location_level(
            TurboObjectUtil.Position.get_location(location_object))
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboObjectUtil.Position.get_location(location_object)))
        location_route_position = TurboObjectUtil.Position.get_position(
            location_object) + get_object_fixed_direction(location_object)
    elif interaction_context is not None:
        game_object_id = -1
        location_position = get_floor_object_position(location_object,
                                                      interaction_context)
        location_level = get_floor_object_level(location_object,
                                                interaction_context)
        location_angle = TurboMathUtil.Orientation.convert_orientation_to_angle(
            TurboMathUtil.Location.get_location_orientation(
                TurboSimUtil.Location.get_location(sim_identifier)))
        location_route_position = location_position
    else:
        return
    origin_position = TurboSimUtil.Location.get_position(
        sim_identifier) if origin_position is None else origin_position
    pre_sex_handler = PreSexInteractionHandler(
        interaction_type, TurboManagerUtil.Sim.get_sim_id(sim_identifier),
        location_identifier, game_object_id, 0,
        TurboWorldUtil.Lot.get_active_lot_id(), location_position.x,
        location_position.y, location_position.z, location_level,
        location_angle, location_route_position.x, location_route_position.y,
        location_route_position.z, location_level)
    sim_ev(sim_identifier).active_pre_sex_handler = pre_sex_handler
    if interaction_type is not None:
        open_start_sex_sims_picker_dialog(origin_position, pre_sex_handler)
    else:
        open_start_random_sex_sims_picker_dialog(origin_position,
                                                 pre_sex_handler)
Example #7
0
def _test_for_change_sex_location(interaction_context, interaction_sim, interaction_target, sex_category_types):
    if interaction_target is None:
        return False
    active_sex_handler = sim_ev(interaction_sim).active_sex_handler
    if active_sex_handler is None:
        return False
    if active_sex_handler.is_playing is False:
        return False
    if TurboTypesUtil.Objects.is_game_object(interaction_target):
        object_position = TurboObjectUtil.Position.get_position(interaction_target) + get_object_fixed_direction(interaction_target)
        target_room_id = TurboWorldUtil.Lot.get_room_id(TurboObjectUtil.Position.get_location(interaction_target), position=object_position)
    elif interaction_context is not None:
        target_room_id = TurboWorldUtil.Lot.get_room_id(TurboMathUtil.Location.get_location(get_floor_object_position(interaction_target, interaction_context), get_floor_object_level(interaction_target, interaction_context), 0))
    else:
        return False
    if target_room_id != TurboWorldUtil.Lot.get_room_id(active_sex_handler.get_location()):
        return False
    if TurboTypesUtil.Objects.is_game_object(interaction_target):
        interaction_target = TurboObjectUtil.GameObject.get_parent(interaction_target)
        if active_sex_handler.get_game_object_id() == TurboResourceUtil.Resource.get_id(interaction_target):
            return False
        if not is_sim_allowed_on_active_lot(interaction_sim) and TurboWorldUtil.Lot.is_position_on_active_lot(TurboObjectUtil.Position.get_position(interaction_target)):
            return False
    else:
        if not is_safe_floor_object_position(interaction_target, interaction_context):
            return False
        if TurboTypesUtil.Objects.is_terrain(interaction_target) and not is_sim_allowed_on_active_lot(interaction_sim) and TurboWorldUtil.Lot.is_position_on_active_lot(get_floor_object_position(interaction_target, interaction_context)):
            return False
    object_identifier = SexInteractionLocationType.get_location_identifier(interaction_target)
    genders_list = list()
    for actor_sim_info in active_sex_handler.get_actors_sim_info_gen():
        genders_list.append(get_sim_sex_gender(actor_sim_info))
    has_animations = False
    for sex_category_type in sex_category_types:
        while has_animations_with_params(sex_category_type, object_identifier, genders_list):
            has_animations = True
            break
    if has_animations is False:
        return False
    return True