From 89693f968cf04f23cfab5e0c8d4df868404623bc Mon Sep 17 00:00:00 2001 From: popertots Date: Sat, 21 Mar 2026 14:50:31 +0000 Subject: [PATCH] add debug --- src/entities/livestock/rabbit.rs | 144 ++++++++++++++++++++++++++++++- src/main.rs | 4 + src/world/tiles/chunk_data.rs | 2 +- 3 files changed, 146 insertions(+), 4 deletions(-) diff --git a/src/entities/livestock/rabbit.rs b/src/entities/livestock/rabbit.rs index 211e4f2..29bf26e 100644 --- a/src/entities/livestock/rabbit.rs +++ b/src/entities/livestock/rabbit.rs @@ -15,6 +15,13 @@ use rand::RngExt; /// 5 seconds at normal speed — slow enough to observe, fast enough to test. pub const DIG_INTERVAL_SECS: f32 = 5.0; +/// Temporary debug component. Attached to a rabbit for N ticks after it digs. +/// Removed automatically when tick_count reaches 0. +#[derive(Component)] +pub struct RabbitFallDebug { + pub ticks_remaining: u8, +} + /// Tracks time until next dig action. Debug component — rabbits dig to demonstrate /// the TileChangedEvent + path invalidation pipeline. Remove or replace when /// real digging mechanics are implemented. @@ -110,13 +117,14 @@ pub fn spawn_rabbits( /// z-level. Also clears the corresponding ChunkData bits via TileMap::remove_floor. /// Fires TileChangedEvent so path invalidation reacts automatically. pub fn rabbit_dig_system( - mut query: Query<(&Transform, &mut RabbitDigTimer)>, + mut commands: Commands, + mut query: Query<(Entity, &Transform, &mut RabbitDigTimer)>, mut tilemap: ResMut, mut tile_changed: MessageWriter, mut occlusion: MessageWriter, time: Res