/** * Combat & Weapons System Handlers * * Complete combat implementation including: * - Weapon Base (creation, mesh, sockets, stats) * - Firing Modes (hitscan, projectile, spread, recoil, ADS) * - Projectiles (creation, movement, collision, homing) * - Damage System (damage types, execution, hitboxes) * - Weapon Features (reload, ammo, attachments, switching) * - Effects (muzzle flash, tracer, impact, shell ejection) * - Melee Combat (traces, combos, hitstop, hit reactions, parry, block, trails) * * @module combat-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 combat & weapon actions for the manage_combat tool. */ export async function handleCombatTools( action: string, args: HandlerArgs, tools: ITools ): Promise> { const { argsRecord, sendRequest } = createSubActionDispatcher(tools, args, { toolName: 'manage_combat', domainName: 'combat', pathFields: [ 'blueprintPath', 'meshPath', 'projectilePath', 'damageTypePath', 'effectPath' ] }); switch (action) { // ========================================================================= // 15.1 Weapon Base (4 actions) // ========================================================================= case 'create_weapon_blueprint': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('create_weapon_blueprint'); } case 'configure_weapon_mesh': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_weapon_mesh'); } case 'configure_weapon_sockets': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_weapon_sockets'); } case 'set_weapon_stats': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('set_weapon_stats'); } // ========================================================================= // 15.2 Firing Modes (5 actions) // ========================================================================= case 'configure_hitscan': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_hitscan'); } case 'configure_projectile': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_projectile'); } case 'configure_spread_pattern': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_spread_pattern'); } case 'configure_recoil_pattern': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_recoil_pattern'); } case 'configure_aim_down_sights': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_aim_down_sights'); } // ========================================================================= // 15.3 Projectiles (4 actions) // ========================================================================= case 'create_projectile_blueprint': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('create_projectile_blueprint'); } case 'configure_projectile_movement': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_projectile_movement'); } case 'configure_projectile_collision': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_projectile_collision'); } case 'configure_projectile_homing': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_projectile_homing'); } // ========================================================================= // 15.4 Damage System (3 actions) // ========================================================================= case 'create_damage_type': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('create_damage_type'); } case 'configure_damage_execution': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_damage_execution'); } case 'setup_hitbox_component': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_hitbox_component'); } // ========================================================================= // 15.5 Weapon Features (4 actions) // ========================================================================= case 'setup_reload_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_reload_system'); } case 'setup_ammo_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_ammo_system'); } case 'setup_attachment_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_attachment_system'); } case 'setup_weapon_switching': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_weapon_switching'); } // ========================================================================= // 15.6 Effects (4 actions) // ========================================================================= case 'configure_muzzle_flash': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_muzzle_flash'); } case 'configure_tracer': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_tracer'); } case 'configure_impact_effects': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_impact_effects'); } case 'configure_shell_ejection': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_shell_ejection'); } // ========================================================================= // 15.7 Melee Combat (6 actions) // ========================================================================= case 'create_melee_trace': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('create_melee_trace'); } case 'configure_combo_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_combo_system'); } case 'create_hit_pause': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('create_hit_pause'); } case 'configure_hit_reaction': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_hit_reaction'); } case 'setup_parry_block_system': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('setup_parry_block_system'); } case 'configure_weapon_trails': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_weapon_trails'); } // ========================================================================= // Utility (1 action) // ========================================================================= case 'get_combat_info': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('get_combat_info'); } // ========================================================================= // Aliases // ========================================================================= case 'setup_damage_type': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('setup_damage_type'); } case 'configure_hit_detection': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('configure_hit_detection'); } case 'get_combat_stats': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('get_combat_stats'); } // ========================================================================= // New Sub-Actions // ========================================================================= case 'create_damage_effect': { requireNonEmptyString(argsRecord.name, 'name', 'Missing required parameter: name'); return sendRequest('create_damage_effect'); } case 'apply_damage': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('apply_damage'); } case 'heal': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('heal'); } case 'create_shield': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('create_shield'); } case 'modify_armor': { requireNonEmptyString(argsRecord.blueprintPath, 'blueprintPath', 'Missing required parameter: blueprintPath'); return sendRequest('modify_armor'); } // ========================================================================= // Default / Unknown Action // ========================================================================= default: return cleanObject({ success: false, error: 'UNKNOWN_ACTION', message: `Unknown combat action: ${action}` }); } }