Task #21: animals roam the whole farm, never lost on their own
Loose animals now roam the whole playable map, day and night. Each walk goes to a goal 4-8 m away that is walkable, in a clear straight line, at least 2 m inside FarmZones.playable (passed into AnimalSystem.setup), and neither inside the pen nor across it. Every morning a loose animal is back at its loose spot (no save change). Animals no longer escape on their own: - _stray and LootSystem.animal_escaped are gone. - A new LootSystem.animal_loose makes an animal LOOSE where it stands and unpens it. It covers a carrier killed or scared (drop), a broken follow leash, and an animal getting out of an open pen (animal_strays, which still records animals_strayed). - An animal dropped inside the pen is home again. - An animal let out of an open pen walks out along the escape field, then roams. If the pen shuts first, it stays home. - return_dropped still pens followers at dawn's end, but leaves loose animals loose. - The only loss paths left are a carrier leaving the farm (thief escape, or removal with reason LEFT). Loose spots at x = -12 move inward to (6|9|12, 0.5). The toast, review-panel, dropped-animal toast, RULES.md and header text no longer promise animals wander off or run for the edge. test_targets: _loose_start has a 90 s day + 90 s night roam run (every animal >4 m, never off the map or into the pen, none lost), a morning reset to the spots, a killed carrier leaving the animal loose, and an unopposed thief carrying one off. _animal_theft, _leading, _breach and _make_loose follow the new rules. AWAY moves off the map so roaming animals can't start following the parked scarecrow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
26b735d3e6
commit
aaf5a81b4e
8 changed files with 379 additions and 226 deletions
|
|
@ -6,7 +6,7 @@ extends Node
|
|||
## repair, shed drop-off) -> weapons (recharge, switching) -> aim and attack (pitchfork, corn
|
||||
## shooter, pumpkin bombs) -> enemies (behavior, steering, motion, collision, traps) -> enemy
|
||||
## melee -> automated defenses -> shots -> pumpkin bombs -> recovery by touch -> animals
|
||||
## (wander, stray, follow) -> night arrivals (WaveDirector) -> deferred enemy removals ->
|
||||
## (wander, roam, follow) -> night arrivals (WaveDirector) -> deferred enemy removals ->
|
||||
## flow-field rebuild slice -> render upload -> campaign phase timers and outcome.
|
||||
## Whenever the structures change (built, broken, dismantled), the flow fields are rebuilt as
|
||||
## FieldJobs in slices of flow_slice_cells per tick; thieves keep using the old fields until the
|
||||
|
|
@ -16,8 +16,8 @@ extends Node
|
|||
## escape: WaveDirector.ground_spawns are the edge cells with a route in), owns the combat and theft systems,
|
||||
## and applies the phase rules: thieves arrive only at night (the night's NightPlan, run by
|
||||
## WaveDirector), sunrise makes them retreat (carriers keep running), the end of the dawn grace
|
||||
## sends the rest off the farm with whatever they carry, returns dropped loot (and loose animals)
|
||||
## home, and regrows the gather points, and every new morning (also after a retry) resets the
|
||||
## sends the rest off the farm with whatever they carry, returns dropped loot (and the animals
|
||||
## still following the scarecrow) home, and regrows the gather points, and every new morning (also after a retry) resets the
|
||||
## theft state from the farm state. DayNight lights the phases; PhaseHud, AssetHud, ReviewPanel,
|
||||
## and the other HUD parts show them. Co-op (CoopSession): a second scarecrow (add_partner) is
|
||||
## simulated alongside the first, and on the partner's machine the farm is a replica: nothing is
|
||||
|
|
@ -182,7 +182,7 @@ func _ready() -> void:
|
|||
loot.animals = animals
|
||||
loot.shed_stock = shed_stock
|
||||
loot.setup(campaign, zones.crop_units(), enemies, AnimalSystem.find_animals(pen_zone).size())
|
||||
animals.setup(campaign, pen_zone, nav, loot, enemies, player)
|
||||
animals.setup(campaign, pen_zone, nav, loot, enemies, player, zones.playable)
|
||||
if animals.count != config.start_animals:
|
||||
push_warning("The pen holds %d animals but GameConfig.start_animals is %d" % [animals.count, config.start_animals])
|
||||
enemies.enemy_removed.connect(loot.on_enemy_removed)
|
||||
|
|
@ -334,7 +334,7 @@ func _ready() -> void:
|
|||
toasts.push("Breach! A %s was broken" % StructureSystem.NAMES[type].to_lower(), Color(1.0, 0.35, 0.3)))
|
||||
animals.pen_changed.connect(func(open: bool) -> void:
|
||||
if open and campaign.state.phase != CampaignController.Phase.MORNING:
|
||||
toasts.push("The pen is open: animals will wander out at night", Color(1.0, 0.55, 0.35)))
|
||||
toasts.push("The pen is open: at night the animals in it will get out and roam loose", Color(1.0, 0.55, 0.35)))
|
||||
scarecrow.patch_denied.connect(func(missing: Dictionary) -> void:
|
||||
toasts.push("Not enough straw to patch up: need %s more" % ResourceStore.describe(missing), Color(1.0, 0.8, 0.5)))
|
||||
if alerts != null:
|
||||
|
|
@ -768,8 +768,8 @@ func _on_phase_changed(phase: CampaignController.Phase, _previous: CampaignContr
|
|||
|
||||
|
||||
## End of the dawn grace: whoever is still on the farm leaves (carrying their loot off), and
|
||||
## loot still lying on the ground goes home (crops to their plots, sacks to the shed, loose
|
||||
## animals to the pen). #13: grows crops_total for any field that just sprouted (state.night is
|
||||
## loot still lying on the ground goes home (crops to their plots, sacks to the shed, animals
|
||||
## still following the scarecrow to the pen; #21: loose animals stay loose). #13: grows crops_total for any field that just sprouted (state.night is
|
||||
## the night that just finished; nights_survived isn't set to it until right after this signal),
|
||||
## so the morning snapshot (retry, the save file) already has it right. The new field's units
|
||||
## themselves flip from DORMANT to HOME in loot.sync_from_state(), at the morning that follows.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue