feat(ecs): wildlife_near / wildlife_near_of into the caller's list, wildlife_alive_of
The living animals around a point from the grid (a rare species from its own list), into a list the caller keeps in its own state, so a frame's proximity question walks the cells it covers rather than every animal ever made. wildlife_alive_of is the species index's count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
045bf22e10
commit
7ceefa8c50
3 changed files with 20 additions and 0 deletions
|
|
@ -243,6 +243,10 @@ program WildlifeTest {
|
|||
expect_eq(wildlife_count(wildlife_st, 1), 0)
|
||||
expect(wildlife_nearest(wildlife_st, -1, 0.0, 0.0, 0.0) == a)
|
||||
expect(wildlife_nearest(wildlife_st, 1, 0.0, 0.0, 0.0) == c)
|
||||
let near = new []WildAnimal
|
||||
expect_eq(wildlife_near(wildlife_st, 0.0, 0.0, 40.0, near), 2)
|
||||
expect_eq(wildlife_near_of(wildlife_st, 0, 0.0, 0.0, 200.0, near), 2)
|
||||
expect_eq(wildlife_alive_of(wildlife_st, 1), 1)
|
||||
wildlife_remove(a)
|
||||
expect_eq(wildlife_count(wildlife_st, 0), 1)
|
||||
expect(wildlife_nearest(wildlife_st, 0, 0.0, 0.0, 0.0) == b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue