Task #13: two new crop fields with staged growth (Night 2 / Night 4)

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>
This commit is contained in:
Forrest 2026-10-05 15:52:38 -04:00
parent 0613cca408
commit 62edb8e04c
8 changed files with 974 additions and 28 deletions

View file

@ -125,10 +125,12 @@ func _requests() -> void:
_pump(2)
r.check(host.campaign.state.phase == P.DAY and client.campaign.state.phase == P.DAY, "the partner can start the day (the host does it)")
host.campaign.state.resources.shed = {"wood": 40, "scrap": 30, "straw": 30}
client.player.global_position = Vector3(2.0, 0.0, 6.0)
# #13: the 3 m walkway between the two new crop fields (x -1..2, z 2..12) -- open ground, clear
# of both fields' crop rows -- stands in for the once-empty spot this used to build in.
client.player.global_position = Vector3(0.5, 0.0, 6.0)
_pump(4)
var before := host.structures.count()
client.build.place_request.call("fence", 3.5, 8.0, 0)
client.build.place_request.call("fence", 0.5, 8.0, 0)
_pump(20)
r.check(host.structures.count() == before + 1 and client.structures.count() == before + 1 and _same_state(),
"the partner builds a fence: the host checks it, builds it, and both farms show it")