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)
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
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
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')
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
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
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
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
def c_api_get_objects(zone_id): with global_zone_lock(zone_id): return get_objects()
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)
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)
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)
def c_api_find_object(obj_id, zone_id): with global_zone_lock(zone_id): return find_object(obj_id)
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
def c_api_get_child_objects(obj_id, zone_id): with global_zone_lock(zone_id): return get_child_objects_by_id(obj_id)
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.')