feat: Allow TileState to hold ItemType (Seeds)

This commit is contained in:
demenik
2025-12-02 12:53:58 +01:00
parent 3009d09720
commit 3da9931513
5 changed files with 27 additions and 19 deletions

View File

@@ -4,6 +4,12 @@ use pomomon_garden::features::pom::utils::find_path;
use pomomon_garden::prelude::*;
use std::collections::VecDeque;
const OBSTACLE: TileState = TileState::Occupied {
seed: ItemType::BerrySeed {
name: "test".into(),
},
};
// Helper to set up a Bevy App for pathfinding tests
fn setup_pathfinding_app(
grid_width: u32,
@@ -89,11 +95,7 @@ fn test_find_path_simple() {
#[test]
fn test_find_path_around_obstacle() {
let obstacles = vec![
(2, 2, TileState::Occupied),
(2, 3, TileState::Occupied),
(2, 4, TileState::Occupied),
];
let obstacles = vec![(2, 2, OBSTACLE), (2, 3, OBSTACLE), (2, 4, OBSTACLE)];
let mut app = setup_pathfinding_app(5, 5, &obstacles);
let _ = app.world_mut().insert_resource(PathResult(None));
@@ -136,11 +138,11 @@ fn test_find_path_around_obstacle() {
#[test]
fn test_find_path_no_path() {
let obstacles = vec![
(2, 0, TileState::Occupied),
(2, 1, TileState::Occupied),
(2, 2, TileState::Occupied),
(2, 3, TileState::Occupied),
(2, 4, TileState::Occupied),
(2, 0, OBSTACLE),
(2, 1, OBSTACLE),
(2, 2, OBSTACLE),
(2, 3, OBSTACLE),
(2, 4, OBSTACLE),
];
let mut app = setup_pathfinding_app(5, 5, &obstacles);