Conversation
…pooka) pig now farm aura
47d8bc8 to
6165d49
Compare
|
Im currently working on some unit / E2E tests I have some but the structure is shit. I actually use the create test state from gravity system but I dont need everything |
|
Currently have an issue with step down limited to 1 block ... |
…re, used by both pathfinding and collision systems
cea299a to
13eb519
Compare
| /// system and the pathfinding system. | ||
| #[inline] | ||
| pub fn is_solid(id: BlockStateId) -> bool { | ||
| SOLID_BLOCKS[id.raw() as usize] |
There was a problem hiding this comment.
Blockstateids aren't checked to be valid, can we return false instead of panicking
| pub fn register_mob_systems(schedule: &mut Schedule) { | ||
| schedule.add_systems(pig::tick_pig); | ||
| schedule.add_systems(pathfinding::tick_pathfinder); | ||
| schedule.add_systems(pig::tick_pig.after(pathfinding::tick_pathfinder)); |
There was a problem hiding this comment.
can we its weird, but this would actually run the pathfinder twice cos the .after() method also adds it's argument to the ecs. could we use ().chain() instead to make it clearer and more extendable?
|
|
||
| fn get_block(world: &temper_world::World, x: i32, y: i32, z: i32) -> BlockStateId { | ||
| let pos = BlockPos::of(x, y, z); | ||
| // Only read from cache — never generate chunks during pathfinding |
There was a problem hiding this comment.
Why not? Also chunks might not be cached but could be in the database. Use the world.load_chunk() method
| /// - 8 : water, honey blocks, danger zones (near fire/cactus) | ||
| /// - 16 : fire, lava, magma, lit campfire | ||
| #[inline] | ||
| pub fn block_penalty(id: BlockStateId) -> i32 { |
There was a problem hiding this comment.
See the comments in src/core/src/block_properties, they apply to this, as well as the PATHFINDING_COSTS above.
| IMPASSABLE | ||
| } | ||
|
|
||
| fn is_non_solid(name: &str) -> bool { |
There was a problem hiding this comment.
You already have this in src/core/src/block_properties
| /// advances the A* search incrementally (budget_per_tick nodes/tick) and updates `path`. | ||
| /// The mob AI reads `current_waypoint()` and calls `advance_waypoint()` when it arrives. | ||
| #[derive(Component)] | ||
| pub struct Pathfinder { |
There was a problem hiding this comment.
put this in the components crate
| // Steer horizontally toward the center of the next waypoint block. | ||
| let dx = (next.pos.x as f64 + 0.5 - pig_pos.x) as f32; | ||
| let dz = (next.pos.z as f64 + 0.5 - pig_pos.z) as f32; | ||
| let len = (dx * dx + dz * dz).sqrt(); |
There was a problem hiding this comment.
#15
this one need to be merged first sry for this incomprehensible diff