• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python argument_helpers.get_optional_target函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中server_commands.argument_helpers.get_optional_target函数的典型用法代码示例。如果您正苦于以下问题:Python get_optional_target函数的具体用法?Python get_optional_target怎么用?Python get_optional_target使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_optional_target函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_sims_for_job

def get_sims_for_job(session_id, sim_id, situation_type, job_type, *job_assignments, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    situation_start_time = services.time_service().sim_now
    duration = situation_type.duration
    if duration > 0:
        situation_end_time = situation_start_time + date_and_time.create_time_span(0, 0, duration)
    else:
        situation_start_time = date_and_time.INVALID_DATE_AND_TIME
        situation_end_time = date_and_time.INVALID_DATE_AND_TIME
    results = services.sim_filter_service().submit_filter(job_type.filter, None, requesting_sim_info=sim.sim_info, start_time=situation_start_time, end_time=situation_end_time, allow_yielding=False)
    if job_type.additional_filter_for_user_selection:
        sim_constraints = {result.sim_info.id for result in results}
        results = services.sim_filter_service().submit_filter(job_type.additional_filter_for_user_selection, None, requesting_sim_info=sim.sim_info, start_time=situation_start_time, end_time=situation_end_time, sim_constraints=sim_constraints, allow_yielding=False)
    msg = Situations_pb2.SituationJobSims()
    msg.situation_session_id = session_id
    msg.job_resource_id = job_type.guid
    msg.requirements = job_type.requirement_text
    results.sort(key=lambda x: (x.sim_info.is_npc, x.sim_info.last_name))
    for result in results:
        msg.sim_ids.append(result.sim_info.id)
        with ProtocolBufferRollback(msg.sims) as situation_job_sim:
            situation_job_sim.sim_id = result.sim_info.id
            if result.sim_info.household.id == services.active_household_id():
                situation_job_sim.account_id = result.sim_info.account_id
            while result.conflicting_career_track_id:
                situation_job_sim.career_track_id = result.conflicting_career_track_id
    shared_messages.add_message_if_selectable(services.object_manager().get(sim.id), Consts_pb2.MSG_SITUATION_JOB_SIMS, msg, True)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:27,代码来源:situation_commands.py


示例2: get_valid_situation_locations

def get_valid_situation_locations(sim_id, situation_type, *guests, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    if not sim:
        sims4.commands.output('Invalid Sim ID: {}'.format(sim_id), _connection)
        return
    sim_info = sim.sim_info
    possible_zones = []
    possible_zones.append(sim_info.household.home_zone_id)
    for guest_id in guests:
        guest_id = int(guest_id)
        guest_info = services.sim_info_manager().get(guest_id)
        while guest_info is not None:
            guest_zone_id = guest_info.household.home_zone_id
            if guest_zone_id is not None and guest_zone_id and guest_zone_id not in possible_zones:
                possible_zones.append(guest_zone_id)
    venue_service = services.current_zone().venue_service
    for venue_type in situation_type.venue_types:
        possible_zones.extend(venue_service.get_zones_for_venue_type(venue_type))
    venue_manager = services.get_instance_manager(sims4.resources.Types.VENUE)
    persistence_service = services.get_persistence_service()
    locations_msg = Situations_pb2.SituationLocations()
    cas_zones_msg = InteractionOps_pb2.CASAvailableZonesInfo()
    world_info_msg = cas_zones_msg.zones.add()
    for zone_id in possible_zones:
        zone_data = persistence_service.get_zone_proto_buff(zone_id)
        if zone_data is None:
            pass
        neighborhood_data = persistence_service.get_neighborhood_proto_buff(zone_data.neighborhood_id)
        if neighborhood_data is None:
            pass
        lot_data = None
        for lot_owner_data in neighborhood_data.lots:
            while zone_id == lot_owner_data.zone_instance_id:
                lot_data = lot_owner_data
                break
        while zone_data is not None and lot_data is not None:
            location_data = Dialog_pb2.LotInfoItem()
            location_data.zone_id = zone_data.zone_id
            location_data.name = zone_data.name
            location_data.world_id = zone_data.world_id
            location_data.lot_template_id = zone_data.lot_template_id
            location_data.lot_description_id = zone_data.lot_description_id
            venue_type_id = build_buy.get_current_venue(zone_id)
            venue_instance = venue_manager.get(venue_type_id)
            if venue_instance is not None:
                location_data.venue_type_name = venue_instance.display_name
            if lot_data.lot_owner:
                household_id = lot_data.lot_owner[0].household_id
                household = services.household_manager().get(household_id)
                if household is not None:
                    location_data.household_name = household.name
            locations_msg.situation_locations.append(location_data)
            with ProtocolBufferRollback(world_info_msg.zones) as zone_info_msg:
                zone_info_msg.id = zone_data.zone_id
                zone_info_msg.name = zone_data.name
                zone_info_msg.world_id = zone_data.world_id
                zone_info_msg.lot_template_id = zone_data.lot_template_id
                zone_info_msg.lot_description_id = zone_data.lot_description_id
    shared_messages.add_object_message_for_sim_id(sim.id, Consts_pb2.MSG_NS_AVAILABLE_ZONES_INFO, cas_zones_msg)
    shared_messages.add_object_message_for_sim_id(sim.id, Consts_pb2.MSG_SITUATION_LOCATIONS, locations_msg)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:60,代码来源:situation_commands.py


示例3: test_ping_autonomy

def test_ping_autonomy(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('No target for autonomy.run', _connection)
        return
    selected_interaction = sim.run_test_autonomy_ping()
    sims4.commands.output('Autonomy Test Ping: {}'.format(selected_interaction), _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:autonomy_commands.py


示例4: pregnancy_clear

def pregnancy_clear(sim_id:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    if sim is not None:
        pregnancy_tracker = sim.sim_info.pregnancy_tracker
        pregnancy_tracker.clear_pregnancy()
        return True
    return False
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:pregnancy_commands.py


示例5: make_greeted

def make_greeted(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('Invalid sim: {} provided.'.format(opt_sim), _connection)
        return
    situation_manager = services.get_zone_situation_manager()
    situation_manager.make_waiting_player_greeted(sim)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:situation_commands.py


示例6: broadcasters_add

def broadcasters_add(broadcaster_type, broadcasting_object:OptionalTargetParam=None, _connection=None):
    broadcasting_object = get_optional_target(broadcasting_object, _connection)
    if broadcasting_object is None:
        return False
    broadcaster = broadcaster_type(broadcasting_object=broadcasting_object)
    services.current_zone().broadcaster_service.add_broadcaster(broadcaster)
    return True
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:broadcaster_commands.py


示例7: automation_current_active_role

def automation_current_active_role(opt_target:OptionalTargetParam=None, _connection=None):
    target = get_optional_target(opt_target, _connection)
    if target is None:
        sims4.commands.automation_output('SimRole; SimId:None', _connection)
        return False
    role = target.active_roles().__class__.__name__ if target.active_roles() is not None else 'None'
    sims4.commands.automation_output('SimRole; SimId:{}, Role:{}'.format(target.id, role), _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:role_commands.py


示例8: genalogy_print

def genalogy_print(sim_id:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    if sim is None:
        return False
    genealogy = sim.sim_info.genealogy
    genealogy.log_contents()
    return True
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:7,代码来源:genealogy_commands.py


示例9: get_carried_objects

def get_carried_objects(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('Invalid Sim id: {}'.format(opt_sim), _connection)
        return False
    for (hand, _, obj) in get_carried_objects_gen(sim):
        sims4.commands.output('\t{}: {}'.format(hand, obj), _connection)
    return True
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:placement_commands.py


示例10: current_active_role

def current_active_role(opt_target:OptionalTargetParam=None, _connection=None):
    target = get_optional_target(opt_target, _connection)
    if target is None:
        return False
    if target.active_roles():
        sims4.commands.output('Active Roles: {}'.format(target.active_roles()), _connection)
    else:
        sims4.commands.output('Sim has no active role', _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:role_commands.py


示例11: start_single_sim_performance_test

def start_single_sim_performance_test(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('No target for qa.automation.start_single_sim_performance_test', _connection)
        return
    sim.reset(ResetReason.RESET_EXPECTED, None, 'start_single_sim_performance_test')
    services.autonomy_service().start_single_sim_load_test(_connection, sim)
    sim.run_full_autonomy_next_ping()
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:autonomy_commands.py


示例12: career_demote_sim

def career_demote_sim(career_type, opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is not None:
        career = sim.sim_info.career_tracker.get_career_by_uid(career_type.guid64)
        if career is not None:
            career.demote()
            return True
    return False
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:career_commands.py


示例13: reset_achievements

def reset_achievements(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is not None:
        account = services.account_service().get_account_by_id(sim.sim_info.account_id)
        account.achievement_tracker.reset_data()
        sims4.commands.output('Achievements reset complete', _connection)
    else:
        sims4.commands.output('Account not found, please check: |achievements.reset_data <sim id from desired account>', _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:achievement_commands.py


示例14: pregnancy_seed

def pregnancy_seed(seed, sim_id:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    if sim is not None:
        pregnancy_tracker = sim.sim_info.pregnancy_tracker
        if pregnancy_tracker.is_pregnant:
            pregnancy_tracker._seed = seed
            return True
    return False
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:8,代码来源:pregnancy_commands.py


示例15: show_autonomy_settings

def show_autonomy_settings(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output("Couldn't find Sim.", _connection)
        return
    autonomy_state = _convert_state_to_string(sim.get_autonomy_state_setting())
    autonomy_randomization = _convert_randomization_to_string(sim.get_autonomy_randomization_setting())
    selected_sim_autonomy_enabled = services.autonomy_service()._selected_sim_autonomy_enabled
    sims4.commands.output('Autonomy State: {}\nAutonomyRandomization: {}\nSelected Sim Autonomy: {}'.format(autonomy_state, autonomy_randomization, selected_sim_autonomy_enabled), _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:autonomy_commands.py


示例16: remove_modifier

def remove_modifier(handle, opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('No target for autonomy.add_modifier', _connection)
        return
    if sim.remove_statistic_modifier(handle):
        sims4.commands.output('Successfully removed autonomy modifier', _connection)
    else:
        sims4.commands.output('Unable to find autonomy handle: {}'.format(handle), _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:autonomy_commands.py


示例17: create_situation

def create_situation(situation_type, opt_sim:OptionalTargetParam=None, user_facing:bool=True, zone_id:int=0, _connection=None):
    situation_manager = services.get_zone_situation_manager()
    sim = get_optional_target(opt_sim, _connection)
    guest_list = SituationGuestList(False, sim.id)
    situation_id = situation_manager.create_situation(situation_type, guest_list=guest_list, user_facing=user_facing, zone_id=zone_id)
    if situation_id is not None:
        sims4.commands.output('Successfully created situation: {}.'.format(situation_id), _connection)
    else:
        sims4.commands.output('Insufficient funds to create situation', _connection)
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:situation_commands.py


示例18: trigger_invite_over_phone_call

def trigger_invite_over_phone_call(opt_sim:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(opt_sim, _connection)
    if sim is None:
        sims4.commands.output('No sim for households.debug_trigger_invite_over_phone_call.', _connection)
        return False
    if not services.household_manager().debug_trigger_invite_over_phone_call(sim):
        sims4.commands.output('households.debug_trigger_invite_over_phone_call failed to trigger phone call.', _connection)
        return False
    return True
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:household_commands.py


示例19: genealogy_prune

def genealogy_prune(sim_id:OptionalTargetParam=None, _connection=None):
    sim = get_optional_target(sim_id, _connection)
    if sim is None:
        return False
    household = sim.household
    if household is None:
        return False
    household.prune_distant_relatives()
    return True
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:genealogy_commands.py


示例20: singe_sim

def singe_sim(opt_target:OptionalTargetParam=None, set_singed:bool=None, _connection=None):
    sim = get_optional_target(opt_target, _connection)
    if sim is None:
        return False
    sim_info = sim.sim_info
    if set_singed is None:
        sim_info.singed = not sim_info.singed
    else:
        sim_info.singed = set_singed
开发者ID:johndpope,项目名称:sims4-ai-engine,代码行数:9,代码来源:fire_commands.py



注:本文中的server_commands.argument_helpers.get_optional_target函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utilities.print_and_log函数代码示例发布时间:2022-05-27
下一篇:
Python server_command.ServerCommand类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap