Task #20: lettuce and corn fields on the south soil, map grows to 60 x 80

- farm.tscn: LettuceField moves to (-1, 0.44, 25) on the SW soil tile
  (ground_008_004) and CornField to (29, 0.31, 25) on the SE tile
  (ground_011_003), both still 10 x 10 m. Their units keep ids 31-40 /
  41-50, plots 7-10 and sprout nights 2 / 4. The sunflower children are
  replaced: lettuce rows get 8 cabbage heads each (plant_004/005), corn
  rows 10 stalks each (plant_001, scaled ~0.8). Every plant's height
  follows the soil under it (raycast), so none floats.
- South Fields (outside zone) moves to (9.5, 41), 66 x 10, between the
  new south edge (z 35) and the old south fence; its four hay points
  move there too and rest on the soil.
- FarmZones.playable: Rect2(-13, -45, 60, 80), i.e. z -45..35.
- ThiefBehavior: one rect per crop field (field_rects) instead of their
  bounding box; area_for() takes the target's position.
- LootSystem: carried/dropped crop tokens show the crop's own plant
  (CROP_TOKENS), each scene loaded once.
- Tests: test_farm_layout checks the 60 x 80 map, outside zones off the
  map, the later fields on the soil tiles with their own plants standing
  on the soil, side names for both fields, the open east side south of
  the fence, and splits the travel bound (12 s core rule, 16 s for the
  south fields). test_theft: new south edge cell, crop tokens.
  run_tests EDGE/SKY south points follow the edge. test_targets: the
  dropped animal is watched from outside the gate (the carrier now dies
  ~4 m from the west edge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-06 13:10:08 -04:00
parent 26b735d3e6
commit fc7c74fa32
10 changed files with 593 additions and 475 deletions

View file

@ -131,12 +131,12 @@ func _ready() -> void:
shed_stock.setup(campaign, shed_zone, player) # every pile prop in place for the navigation
nav.build(get_parent(), zones.playable.grow(5.0), config.nav_cell_size, config.enemy_radius + config.nav_inflate_margin)
shed_stock.refresh()
# #13: three CROP_FIELD zones now (the original field, lettuce/cabbage, corn); field_rect is
# their bounding box (ThiefBehavior.area_for: "close enough, go straight" once inside it).
var crop_zones := zones.zones_of(FarmZone.Kind.CROP_FIELD)
var field_rect := crop_zones[0].rect()
for i in range(1, crop_zones.size()):
field_rect = field_rect.merge(crop_zones[i].rect())
# #13: three CROP_FIELD zones (the original field, lettuce/cabbage, corn). #20: each keeps its
# own rectangle (ThiefBehavior.area_for: "close enough, go straight" once inside the target's
# field); their bounding box would span most of the map now that the later fields lie south.
var field_rects: Array[Rect2] = []
for z in zones.zones_of(FarmZone.Kind.CROP_FIELD):
field_rects.append(z.rect())
# Goals are the crop rows themselves (not the whole zone), so a fence around the crops
# encloses every goal and thieves have to break in. Likewise the inside of the pen.
var crop_goals := PackedInt32Array()
@ -167,7 +167,7 @@ func _ready() -> void:
animals = AnimalSystem.new()
animals.name = "Animals"
add_child(animals)
behavior.setup(config, nav, loot, crop_field, escape_field, field_rect)
behavior.setup(config, nav, loot, crop_field, escape_field, field_rects)
behavior.pen_rect = pen_zone.rect()
behavior.shed_rect = shed_zone.rect()
behavior.farm_rect = zones.playable