Task #25: arrivals wait for a free character
A planned ground arrival whose type has no free character used to be
skipped (spawn_skipped) and lost. Now it waits and comes in as soon as
one frees, without holding back other types; any still waiting at
sunrise are dropped and counted.
- EnemySystem.can_spawn(type): room and, on foot, a free character
(EnemyCharacters.has_free; a corpse counts), no side effects.
- WaveDirector.step: due arrivals that can't spawn go to a per-type
FIFO; waiting ones are admitted first each tick. waited / dropped
counters next to spawned, reset at nightfall; waiting() for tests.
- GameConfig.character_pool {"thief": 48, "breaker": 20} replaces
EnemyCharacters.POOL; the pools are built from it at setup.
- RULES.md, Night plans: the real limits and the waiting rule.
- test_roster: full thief pool -> the thief waits, crows stay on time,
a freed character (corpse) lets it in, sunrise drops and counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3bb835f7c3
commit
af48cff80d
6 changed files with 201 additions and 13 deletions
|
|
@ -236,9 +236,18 @@ func clear() -> void:
|
|||
characters.clear()
|
||||
|
||||
|
||||
## Whether spawn(enemy_type, ...) would succeed now: a free slot and, for a ground type, a free
|
||||
## character to draw it (EnemyCharacters.has_free: a corpse counts, it can be taken over). No side
|
||||
## effects; WaveDirector holds a due arrival back until it's true.
|
||||
func can_spawn(enemy_type: int) -> bool:
|
||||
if active_count >= capacity or _free_top <= 0:
|
||||
return false
|
||||
return characters == null or t_flying[enemy_type] == 1 or characters.has_free(enemy_type)
|
||||
|
||||
|
||||
## Acquires a slot and initializes every state field. Returns a handle, or -1 if the pool is
|
||||
## exhausted, or for a ground enemy there's no free character to draw it (the spawn is skipped
|
||||
## and counted; nothing grows).
|
||||
## and counted in spawn_skipped; nothing grows. WaveDirector checks can_spawn first instead).
|
||||
func spawn(enemy_type: int, x: float, z: float, heading: Vector2, p_want: int = LootSystem.ANY) -> int:
|
||||
if active_count >= capacity or _free_top <= 0:
|
||||
spawn_skipped += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue