Adds a Lettuce/Cabbage field (ids 31-40, x -11..-1 z 2..12) and a Corn field
(ids 41-50, x 2..12 z 2..12), each 2 plots of 5 units, placeholder plants
reusing plant_007/plant_008. CropUnit gains crop (cosmetic) and sprout_night
(0/2/4) fields. LootSystem gains a DORMANT status: a unit whose field hasn't
sprouted (FarmState.nights_survived < sprout_night) is hidden and never
claimable/recoverable, and is excluded from crops_total so it can't affect
scoring or the "farm stripped" check. sync_from_state() derives DORMANT vs.
HOME from nights_survived every morning (and after a retry/load), and
self-heals crops_total to the sprouted count; FarmSim.grow_crops_total() also
grows it right at night_ending so the morning snapshot (retry, the save file)
already has it right. FarmZones.crop_units() now gathers CropUnits from every
CROP_FIELD zone (there are three now), not just the first found; the same fix
applies to FarmSim's crop-area rect and the fence breakers' guarded areas.
Reworks test_farm_layout's zone-count and crop checks for the extra fields,
and test_theft's start-of-run and FarmState-consistency checks, which assumed
every crop unit was always in play; adds test_theft cases for both fields
sprouting on schedule, dormant units being unclaimable, and a sprouted unit
being stealable and scored, including a save/JSON round trip. Nudges
test_coop's co-op build spot into the 3 m walkway between the two new fields,
since its old spot now sits on the corn field's rows.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds LootSystem.Status.LOOSE: animals now start scattered at GameConfig.
animal_loose_spots outside the pen rect and graze in place (AnimalSystem,
anchored to their own spot instead of the pen) instead of starting HOME or
escaping down the field. A thief can still claim and carry a loose animal
off (same DROPPED/escape rules as before); the scarecrow's existing
follow-trail recovery now also picks up a loose animal directly, and
entering the pen makes it HOME as before.
FarmState gains penned_animals (which ids are currently penned), set
whenever an animal becomes HOME (led in, or auto-returned at the dawn
grace) and cleared when it's lost. LootSystem.sync_from_state() uses it
each morning/retry/load to restore penned animals HOME and leave the rest
LOOSE, instead of resetting the whole herd into the pen. Bumped FarmState.
VERSION to 5 with a migration step that pens every surviving animal for
older saves (which always kept them in the pen).
test_targets.gd's existing pen-mechanics suite (containment, straying,
leading in) now pens every animal up front to keep covering that
behavior; a new _loose_start check covers the loose start itself: animals
spawn loose and scattered, graze in place, a thief can still claim and
steal a loose one, leading one in with the follow-trail mechanic pens it,
and a morning resync keeps the penned one home and the rest loose.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>