Пример #1
0
def c_api_create_object(zone_id, def_id, obj_id, obj_state, loc_type):
    with global_zone_lock(zone_id):
        return create_object(def_id,
                             obj_id=obj_id,
                             obj_state=obj_state,
                             loc_type=loc_type,
                             consume_exceptions=False)
Пример #2
0
def c_api_set_build_buy_lockout(zone_id, obj_or_id, lockout_state, permanent_lock=False):
    with global_zone_lock(zone_id):
        obj = _get_obj_for_obj_or_id(obj_or_id)
        if obj is not None:
            obj.set_build_buy_lockout_state(False, None)
            return True
            if permanent_lock:
                obj.set_build_buy_lockout_state(lockout_state, None)
            else:
                obj.set_build_buy_lockout_state(lockout_state, SystemTuning.build_buy_lockout_duration)
            return True
        return False
Пример #3
0
def c_api_set_build_buy_lockout(zone_id,
                                obj_or_id,
                                lockout_state,
                                permanent_lock=False):
    with global_zone_lock(zone_id):
        obj = _get_obj_for_obj_or_id(obj_or_id)
        if obj is not None:
            obj.set_build_buy_lockout_state(False, None)
            return True
            if permanent_lock:
                obj.set_build_buy_lockout_state(lockout_state, None)
            else:
                obj.set_build_buy_lockout_state(
                    lockout_state, SystemTuning.build_buy_lockout_duration)
            return True
        return False
Пример #4
0
def c_api_reset_object(zone_id, obj_or_id):
    with global_zone_lock(zone_id):
        return reset_object(obj_or_id, expected=True, cause='Build/Buy')
Пример #5
0
def c_api_get_object_def_state(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is None:
        return
    return obj.state_index
Пример #6
0
def c_api_set_slot_hash(obj_id, zone_id, slot_hash):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        while obj is not None:
            obj.slot_hash = slot_hash
Пример #7
0
def c_api_get_parent(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is not None:
        return obj.parent
Пример #8
0
def c_api_get_object_definition(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is None:
        return
    return obj.definition.id
Пример #9
0
def c_api_get_objects(zone_id):
    with global_zone_lock(zone_id):
        return get_objects()
Пример #10
0
def c_api_clear_parent_object(obj_id, transform, zone_id, surface):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        obj.clear_parent(transform, surface)
Пример #11
0
def c_api_set_parent_object(obj_id, parent_id, transform, joint_name, slot_hash, zone_id):
    with global_zone_lock(zone_id):
        set_parent_object(obj_id, parent_id, transform, joint_name, slot_hash)
Пример #12
0
def c_api_get_object_definition(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is None:
        return
    return obj.definition.id
Пример #13
0
def c_api_set_object_state_index(obj_id, state_index, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        obj.set_object_def_state_index(state_index)
Пример #14
0
def c_api_get_objects(zone_id):
    with global_zone_lock(zone_id):
        return get_objects()
Пример #15
0
def c_api_find_object(obj_id, zone_id):
    with global_zone_lock(zone_id):
        return find_object(obj_id)
Пример #16
0
def c_api_reset_object(zone_id, obj_or_id):
    with global_zone_lock(zone_id):
        return reset_object(obj_or_id, expected=True, cause='Build/Buy')
Пример #17
0
def c_api_find_object(obj_id, zone_id):
    with global_zone_lock(zone_id):
        return find_object(obj_id)
Пример #18
0
def c_api_get_parent(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is not None:
        return obj.parent
Пример #19
0
def c_api_set_object_state_index(obj_id, state_index, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        obj.set_object_def_state_index(state_index)
Пример #20
0
def c_api_get_slot_hash(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is not None:
        return obj.bone_name_hash
    return 0
Пример #21
0
def c_api_set_parent_object(obj_id, parent_id, transform, joint_name,
                            slot_hash, zone_id):
    with global_zone_lock(zone_id):
        set_parent_object(obj_id, parent_id, transform, joint_name, slot_hash)
Пример #22
0
def c_api_set_slot_hash(obj_id, zone_id, slot_hash):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        while obj is not None:
            obj.slot_hash = slot_hash
Пример #23
0
def c_api_clear_parent_object(obj_id, transform, zone_id, surface):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
        obj.clear_parent(transform, surface)
Пример #24
0
def c_api_get_child_objects(obj_id, zone_id):
    with global_zone_lock(zone_id):
        return get_child_objects_by_id(obj_id)
Пример #25
0
def c_api_get_slot_hash(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is not None:
        return obj.bone_name_hash
    return 0
Пример #26
0
def c_api_get_object_def_state(obj_id, zone_id):
    with global_zone_lock(zone_id):
        obj = find_object(obj_id)
    if obj is None:
        return
    return obj.state_index
Пример #27
0
def c_api_get_child_objects(obj_id, zone_id):
    with global_zone_lock(zone_id):
        return get_child_objects_by_id(obj_id)
Пример #28
0
def c_api_create_object(zone_id, def_id, obj_id, obj_state, loc_type):
    with global_zone_lock(zone_id):
        return create_object(def_id, obj_id=obj_id, obj_state=obj_state, loc_type=loc_type, consume_exceptions=False)
Пример #29
0
def c_api_destroy_object(zone_id, obj_or_id):
    with global_zone_lock(zone_id):
        obj = _get_obj_for_obj_or_id(obj_or_id)
        return obj.destroy(source=obj, cause='Destruction request from C.')
Пример #30
0
def c_api_destroy_object(zone_id, obj_or_id):
    with global_zone_lock(zone_id):
        obj = _get_obj_for_obj_or_id(obj_or_id)
        return obj.destroy(source=obj, cause='Destruction request from C.')