/** * Character & Movement System Handlers * * Complete character setup with advanced movement including: * - Character Creation & Components * - Movement Component Configuration * - Advanced Movement (mantling, vaulting, climbing, etc.) * - Footstep System * * @module character-handlers */ import { ITools } from '../../../types/tools/tool-interfaces.js'; import { cleanObject } from '../../../utils/serialization/safe-json.js'; import type { HandlerArgs } from '../../../types/handlers/handler-types.js'; import { createSubActionDispatcher, requireNonEmptyString } from '../foundation/dispatch/common-handlers.js'; /** * Handles all character & movement actions for the manage_character tool. */ export async function handleCharacterTools( action: string, args: HandlerArgs, tools: ITools ): Promise> { const { argsRecord, sendRequest } = createSubActionDispatcher(tools, args, { toolName: 'manage_character', domainName: 'character', pathFields: [ 'blueprintPath', 'skeletalMeshPath', 'animBlueprintPath', 'meshPath', 'animationBlueprintPath', 'skeletonPath' ] }); switch (action) { // ========================================================================= // 14.1 Character Creation (4 actions) // ========================================================================= case 'create_character_blueprint': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('create_character_blueprint'); } case 'configure_capsule_component': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_capsule_component'); } case 'configure_mesh_component': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_mesh_component'); } case 'configure_camera_component': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_camera_component'); } // ========================================================================= // 14.2 Movement Component (5 actions) // ========================================================================= case 'configure_movement_speeds': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_movement_speeds'); } case 'configure_jump': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_jump'); } case 'configure_rotation': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_rotation'); } case 'add_custom_movement_mode': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); requireNonEmptyString(argsRecord.modeName, 'modeName', 'Missing required parameter: modeName'); return sendRequest('add_custom_movement_mode'); } case 'configure_nav_movement': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_nav_movement'); } // ========================================================================= // 14.3 Advanced Movement (6 actions) // ========================================================================= case 'setup_mantling': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_mantling'); } case 'setup_vaulting': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_vaulting'); } case 'setup_climbing': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_climbing'); } case 'setup_sliding': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_sliding'); } case 'setup_wall_running': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_wall_running'); } case 'setup_grappling': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_grappling'); } // ========================================================================= // 14.4 Footsteps System (3 actions) // ========================================================================= case 'setup_footstep_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_footstep_system'); } case 'map_surface_to_sound': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); requireNonEmptyString(argsRecord.surfaceType, 'surfaceType', 'Missing required parameter: surfaceType'); return sendRequest('map_surface_to_sound'); } case 'configure_footstep_fx': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_footstep_fx'); } // ========================================================================= // Utility (1 action) // ========================================================================= case 'get_character_info': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('get_character_info'); } // ========================================================================= // 14.5 Movement Shortcuts & Configuration (8 actions) // ========================================================================= case 'setup_movement': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_movement'); } case 'set_walk_speed': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_walk_speed'); } case 'set_jump_height': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_jump_height'); } case 'set_gravity_scale': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_gravity_scale'); } case 'set_ground_friction': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_ground_friction'); } case 'set_braking_deceleration': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_braking_deceleration'); } case 'configure_crouch': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_crouch'); } case 'configure_sprint': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_sprint'); } // ========================================================================= // Default / Unknown Action // ========================================================================= default: return cleanObject({ success: false, error: 'UNKNOWN_ACTION', message: `Unknown character action: ${action}` }); } }