refactor(simulation): split the input.rs and dialogue.rs dispatchers (T-1062)
input.rs 2,739 → 858 lines: per-domain action handlers moved to their owning modules (inventory, movement, stance, examine, follow, interaction, save_io, settings, bridge::debug, economy, vision_cone, bookmark, test_world reset + new teleport.rs); input.rs keeps the queue, the thin dispatch table, and pause/cooldown glue. All 9 type_complexity allows dissolved via one PlayerInputQuery alias. dialogue.rs → dialogue/ directory module: selection (631), response (1,473), confrontation (714), mod.rs (226, shared session components + re-exports — public paths preserved). Documented seam deviation: process_walk_away lives with confrontation (D-064/D-063 share the same world-response shape). Mechanical, zero behavior change: determinism + golden_suite byte-identical (independently re-verified); 1,504 lib tests unchanged — 23 input tests moved with their subjects, 53 dialogue tests redistributed, zero deleted. System scheduling registrations untouched (input_plugin.rs 0-line diff). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,34 @@ pub fn facing_from_delta(dx: i32, dy: i32) -> FacingDirection {
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle the SetFacing player action: parse the wire direction string and
|
||||
/// set the player's Facing component. Unknown directions warn and no-op.
|
||||
pub fn handle_set_facing(
|
||||
player_query: &mut crate::simulation::input::PlayerInputQuery,
|
||||
commands: &mut Commands,
|
||||
facing: &str,
|
||||
) {
|
||||
let dir = match facing {
|
||||
"North" => Some(FacingDirection::North),
|
||||
"Northeast" => Some(FacingDirection::Northeast),
|
||||
"East" => Some(FacingDirection::East),
|
||||
"Southeast" => Some(FacingDirection::Southeast),
|
||||
"South" => Some(FacingDirection::South),
|
||||
"Southwest" => Some(FacingDirection::Southwest),
|
||||
"West" => Some(FacingDirection::West),
|
||||
"Northwest" => Some(FacingDirection::Northwest),
|
||||
_ => {
|
||||
tracing::warn!("SetFacing: unknown direction {:?}", facing);
|
||||
None
|
||||
}
|
||||
};
|
||||
if let Some(dir) = dir {
|
||||
if let Ok((entity, _, _, _)) = player_query.single_mut() {
|
||||
commands.entity(entity).insert(Facing(dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Classify a visible tile into a vision sector based on facing direction.
|
||||
/// Returns None if the tile falls outside the forward cone.
|
||||
fn classify_tile(
|
||||
|
||||
Reference in New Issue
Block a user