Task #11: Animal Pen boundary becomes player-built

Delete the 23 fence_024 scene props (and their unused ext_resource) from
Zones/AnimalPen in farm.tscn -- their StaticBody3D colliders permanently
walled the pen in FarmNavigation.build(), so today they're the only thing
enclosing it. FarmZone.Kind.ANIMAL_PEN and AnimalSystem.update_pen_open()
already drive the open/closed check; players now build ordinary fence/gate
structures around the existing pen rect to close it.

Remove the free starting gate from GameConfig.start_structures (now an
empty array): the pen is fully player-built, nothing stands at the start.

Add game/tests/pen_ring.gd, a shared helper with the pen rect's 24-piece
fence/gate layout (the same positions the deleted props and the old
starting gate used to occupy), built through StructureSystem's normal
validate/place path at normal cost.

Rework the pen tests that assumed a pre-built pen:
- test_structures.gd gets a new _pen_boundary check (open with nothing
  built, open with a gap, shut once the ring is complete -- the task's
  acceptance test) and builds the ring there for the rest of the suite;
  _breakout no longer assumes the gate specifically breaks (a retreating
  thief now follows a global escape-to-map-edge field across equally
  breakable ring pieces, not a single gap in a solid wall), checking
  whichever piece breaks and that patching it shuts the pen again.
- test_targets.gd builds the full ring in setup (gate first, so it keeps
  structure id 1) and spawns the animal thief near the gate so its
  "breaks the gate" narrative still holds.
- test_roster.gd's fence-breaker test places only the gate (not the full
  ring): FarmSim._breaker_goals() treats every structure near a zone as
  "guarding" it, so a full ring would turn its two-barriers-then-the-
  scarecrow narrative into twenty-five.
- test_farm_state.gd and test_cycle.gd's stale "the pen's gate" wording
  and assumptions are updated for the empty start_structures.

No new FAIL lines versus the pre-existing baseline (one known-flaky
test_roster check aside, confirmed to pass on isolated reruns).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-05 14:34:02 -04:00
parent aa50e97311
commit eb89268b66
9 changed files with 163 additions and 96 deletions

View file

@ -92,7 +92,6 @@
[ext_resource type="PackedScene" uid="uid://t72a771keby1" path="res://assets/farm/ithappy/farm/prefabs/assets/prop/chair_001.tscn" id="212_chair_001"]
[ext_resource type="PackedScene" uid="uid://ceco5h6fe6hyu" path="res://assets/farm/ithappy/farm/prefabs/assets/prop/table_002.tscn" id="213_table_002"]
[ext_resource type="PackedScene" uid="uid://c5dpfl620ystw" path="res://assets/farm/ithappy/farm/prefabs/assets/prop/bucket_001.tscn" id="214_bucket_001"]
[ext_resource type="PackedScene" uid="uid://dm7inst25lj00" path="res://assets/farm/ithappy/farm/prefabs/assets/prop/fence_024.tscn" id="215_fence_024"]
[ext_resource type="PackedScene" uid="uid://dw1k3ilpn8nll" path="res://assets/farm/ithappy/farm/prefabs/assets/prop/coop_002.tscn" id="217_coop_002"]
[ext_resource type="PackedScene" uid="uid://cr17qkqcl5n5k" path="res://assets/farm/ithappy/farm/prefabs/assets/animal/chicken_001.tscn" id="218_chicken_001"]
[ext_resource type="PackedScene" uid="uid://b1awnl6wg6nur" path="res://assets/farm/ithappy/farm/prefabs/assets/animal/chicken_003.tscn" id="219_chicken_003"]
@ -2313,75 +2312,6 @@ display_name = "Animal Pen"
size = Vector2(14, 10)
tint = Color(0.85, 0.55, 0.3, 1)
[node name="fence_024_1" parent="Zones/AnimalPen" unique_id=1446580389 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, -5)
[node name="fence_024_2" parent="Zones/AnimalPen" unique_id=1858327670 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 5)
[node name="fence_024_3" parent="Zones/AnimalPen" unique_id=1072155173 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, -5)
[node name="fence_024_4" parent="Zones/AnimalPen" unique_id=2082000001 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 5)
[node name="fence_024_5" parent="Zones/AnimalPen" unique_id=1226141495 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -5)
[node name="fence_024_6" parent="Zones/AnimalPen" unique_id=1100914280 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 5)
[node name="fence_024_7" parent="Zones/AnimalPen" unique_id=13821588 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5)
[node name="fence_024_8" parent="Zones/AnimalPen" unique_id=1576318148 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5)
[node name="fence_024_9" parent="Zones/AnimalPen" unique_id=625414246 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, -5)
[node name="fence_024_10" parent="Zones/AnimalPen" unique_id=638219621 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 5)
[node name="fence_024_11" parent="Zones/AnimalPen" unique_id=1078283597 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -5)
[node name="fence_024_12" parent="Zones/AnimalPen" unique_id=961024064 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 5)
[node name="fence_024_13" parent="Zones/AnimalPen" unique_id=796402607 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -5)
[node name="fence_024_14" parent="Zones/AnimalPen" unique_id=2086364847 instance=ExtResource("215_fence_024")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 5)
[node name="fence_024_15" parent="Zones/AnimalPen" unique_id=2064386247 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, -7, 0, -4)
[node name="fence_024_16" parent="Zones/AnimalPen" unique_id=349303733 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 7, 0, -4)
[node name="fence_024_17" parent="Zones/AnimalPen" unique_id=164449478 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, -7, 0, -2)
[node name="fence_024_18" parent="Zones/AnimalPen" unique_id=1944845284 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 7, 0, -2)
[node name="fence_024_19" parent="Zones/AnimalPen" unique_id=909623837 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, -7, 0, 0)
[node name="fence_024_20" parent="Zones/AnimalPen" unique_id=631815421 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, -7, 0, 2)
[node name="fence_024_21" parent="Zones/AnimalPen" unique_id=709037316 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 7, 0, 2)
[node name="fence_024_22" parent="Zones/AnimalPen" unique_id=1495963615 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, -7, 0, 4)
[node name="fence_024_23" parent="Zones/AnimalPen" unique_id=753148669 instance=ExtResource("215_fence_024")]
transform = Transform3D(0, 0, 1, 0, 1, 0, -1, 0, 0, 7, 0, 4)
[node name="coop_002_1" parent="Zones/AnimalPen" unique_id=1811355265 instance=ExtResource("217_coop_002")]
transform = Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, -1, -5.3, 0, -3.4)