fix(simulation): discard movement input while paused

process_player_input processed movement commands regardless of tick
rate, causing the camera to drift from the player when the game was
paused and the player held direction keys. Add PlayerAction::is_movement()
helper and a paused guard that skips movement actions while TickRate is
Paused. Pause/Unpause commands still process normally.

Fixes bug #3 (player moves while game is paused).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 23:25:51 +01:00
co-authored by Claude Opus 4.6
parent d1aba3d554
commit 2b54697278
2 changed files with 22 additions and 0 deletions
+17
View File
@@ -308,6 +308,23 @@ pub enum PlayerAction {
ToggleStanceDown,
}
impl PlayerAction {
/// Returns true for directional movement commands.
pub fn is_movement(&self) -> bool {
matches!(
self,
PlayerAction::MoveNorth
| PlayerAction::MoveSouth
| PlayerAction::MoveEast
| PlayerAction::MoveWest
| PlayerAction::MoveNortheast
| PlayerAction::MoveNorthwest
| PlayerAction::MoveSoutheast
| PlayerAction::MoveSouthwest
)
}
}
/// Available interaction verbs for a nearby entity (D-060, #404)
/// Embedded in ObserverSnapshot.nearby_interactions.
#[derive(Debug, Clone, Serialize, Deserialize)]
+5
View File
@@ -92,12 +92,17 @@ pub fn process_player_input(
inventory_items: Query<(Entity, &CarriedBy, &ItemName, &InventorySlot)>,
) {
let current_tick = time.tick;
let paused = time.paused();
let inputs = input_queue.drain_for_tick(current_tick);
// Track whether any movement was attempted this tick (for cooldown tick advance)
let mut move_attempted = false;
for input in inputs {
// Discard movement while paused (D-052). Pause/Unpause still processed.
if paused && input.action.is_movement() {
continue;
}
match input.action {
PlayerAction::MoveNorth => {
move_attempted = true;