Commit graph

48 commits

Author SHA1 Message Date
Forrest
02b990d362 Merge task #22: the joining player can open the store
The client now shows the "[E / X] Shop" prompt (ShedCounter resolved in
_focus_node); the host holds a partner's interact press up to 0.3 s for
its lagging copy to reach a counter instead of silently dropping it;
interact closes the partner's menu; a partner's purchase equips on its
own slot ("bought" event). PROTOCOL 5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:48:30 -04:00
Forrest
315e6890f7 Task #22: the joining player can open the store
Cause: the open path itself worked. A real two-process run with an E key event opened the
shed's menu when P2 stood at the counter. What failed in play was reach:
- The partner's game never showed the counter's "[E / X] Shop" prompt.
  CoopSession._gather_node resolved only the workbench and gather points, so P2's
  replicated focus was null at the counter. P2 couldn't tell where the 2.2 m reach around
  the counter's invisible point was.
- The host took P2's press on the first tick after the input record arrived, before its
  copy of P2 had eased to the position in that same record. It dropped the press silently
  if the lagging copy was out of reach. Walking in at 5 or 9 m/s and pressing E at 2.1 m
  (inside the reach on P2's screen) failed 3/3. The host's copy was 2.31-2.66 m out.

Fixes:
- The snapshot's focus now resolves the ShedCounter (_focus_node), so the prompt shows.
- The host keeps a partner's interact press pending for 0.3 s (Interactions.PRESS_WINDOW)
  until a counter in reach takes it.
- Interact while the partner's shop menu is open closes it on the partner's machine, and
  that press is taken back (RemoteControls.Sender.take_back), so the host never reopens it.
- When the host completes P2's "buy", it sends a "bought" event. Once P2's farm state has
  the upgrade, the partner's panel emits bought (UpgradePanel.confirm_bought). As in solo,
  the new weapon goes into P2's hand and the jingle plays. Still paid from P2's pouch,
  then the shed.
- CoopSession.PROTOCOL 4 -> 5.

Tests: test_coop _shops covers both shops opening on the client only, the prompt, interact
closing, a press taken while the host's copy is 3.8 m out still opening, an early press not
opening later, and a client weapon buy paid from P2's pouch and the shed and equipped on
both farms. coop_smoke now opens and closes the shed by day with E key events, both
standing and on arrival at a run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:47:52 -04:00
Forrest
fe308d2b72 tasks: check off #18; drop stale Alien Ray projectile comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:42:09 -04:00
Forrest
a0aee34e3c Task #18: Alien Ray fires a beam
The Alien Ray is now a held beam instead of a copy of the potato shot.
While fire is held it ticks every alien_ray_tick_interval (0.15 s). Each
tick traces a path from the scarecrow's center through the muzzle and on
alien_ray_range (20 m) past it, cut short at the first wall
(AlienBeam.trace on the world layer). It damages every enemy within
alien_ray_width / 2 (0.25 m) plus its hit radius of that path, flyers
included as with shots, nearest first, up to alien_ray_pierce (4), for
alien_ray_damage (1). That is about 6.7 damage a second per enemy on the
beam. Hits stay inside combat.step, so enemies.attacker credits kills.

- EnemySystem.path_hits: every enemy along a polyline, ordered along it,
  with flat ends (nothing behind the scarecrow or past the wall).
  sweep_hit is unchanged.
- AlienBeam: a WeaponModels held effect (hold 1.5 ticks, no fade). It is
  an unshaded HDR green core and glow, a muzzle light, and a flare where a
  wall stops it. Each frame it lays itself out from the muzzle along the
  model's -Z, with the same trace, so the partner's machine recomputes the
  wall clip locally. No protocol change.
- Counters: a beam_ticks counter joins attacks(), and ray ticks no
  longer count as shots_fired.
- Config: alien_ray_speed, alien_ray_lifetime and alien_ray_cooldown are
  removed. alien_ray_range, _width, _tick_interval and _pierce are added.
  The shop text says what it does now. Cost and hidden/reveal are
  unchanged.
- Sound: a zapped signal and a "zap" cue (synth alien_beam.wav, its own
  seed). The other synth files regenerate byte-identical.

Tests (test_weapons) replace the projectile-travel ray check and keep
buy/equip:
- a far target is hit on the same step;
- nothing beside, behind or past the end is hit;
- two in line and a crow are all hit;
- a line is capped at pierce;
- a wall stops it, including a barrel poking through one;
- held ticks repeat and stop on release;
- the beam is lit only while held, ends at the wall clip, follows the
  model's yaw, and the replica and attack-event paths work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:39:00 -04:00
Forrest
55ebae4058 Thieves go straight for loose loot in clear view, however far
With #21's animals roaming the whole (now 60 x 80) farm, an animal
thief whose loose target was beyond direct_seek_distance followed the
pen's flow field away from it and gave up after 10 s. Loot away from
home has no home area to head for, so any clear line to it now counts.
Fixes test_roster "a thief walks in through the gap it opened and
takes an animal" on the merged #20 + #21 tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:22:21 -04:00
Forrest
11d19d874a Merge task #20: lettuce and corn fields on the south soil, map 60 x 80
Lettuce (x -6..4) and corn (x 24..34, both z 20..30) sit on the bare
SW/SE soil with cabbage and corn-stalk prefabs and matching crop
tokens; playable map extends south to z 35; SouthFields moved off the
map; per-field thief rects. test_targets conflict resolved in favour of
#21 (dropped animals no longer run for the edge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:19:10 -04:00
Forrest
9d26f29299 Merge task #21: animals roam the whole farm, never lost on their own
Loose animals roam the playable map day and night; dropped, leash-broken
and open-pen animals become LOOSE instead of running for the edge. Only
an Alien carrying one off the map loses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:15:24 -04:00
Forrest
2fc09ca3fa Merge task #16: each co-op player has their own pouch
The shed stays shared; pouches are per avatar slot with one shared
capacity. Gather/deposit/pay paths take the acting slot, goop goes to
the killer, a leaving partner's pouch goes into the shed. FarmState v7
(partner_pouch), CoopSession PROTOCOL 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:15:24 -04:00
Forrest
51b553bba8 Merge task #17: Propane Torch sprays a band of fire
Band hit test from the scarecrow along the aim (torch_width, longer
torch_range), a particle flame held lit while firing (and on the
partner's screen via attack events), reusable held-effect pattern in
WeaponModels, torch roar cue. Resolved farm_audio.gd header with #19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:15:17 -04:00
Forrest
fc7c74fa32 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>
2026-10-06 13:10:08 -04:00
Forrest
aaf5a81b4e 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>
2026-10-06 13:07:13 -04:00
Forrest
fa7f67fe04 Task #16: per-player pouch in co-op
Each scarecrow carries its own pouch (ResourceStore.pouches by avatar
slot; slot 0 is the solo player / host, `pouch` stays slot 0's), with one
shared pouch_capacity so a Bigger pouch grows both. The shed stays shared.

- Gathering, the shed drop-off, repair, upgrade-in-place, patching,
  building and buying all act on the acting avatar's slot. The host pays
  the partner's "place" and "buy" requests from P2's pouch and the shed.
- The partner's build mode, build hotbar, shop menus and materials HUD
  check affordability against P2's pouch (FarmSim.set_local).
- Alien Goop goes to the killer's pouch: FarmSim sets
  EnemySystem.attacker around each avatar's combat step and shots carry
  their shooter's slot; bomb/turret kills go to the nearest scarecrow.
  The replica no longer rolls goop locally.
- When the partner leaves, their pouch goes into the shed (and is named
  in the toast); a co-op save continued alone banks P2's pouch at morning.
- FarmState.VERSION 7 (resources.partner_pouch) with a v6 migration;
  CoopSession.PROTOCOL 4.
- Tests: per-slot store rules, v6 save migration, and test_coop cases for
  separate gathering, no cross-banking in the shed, own-pouch paying,
  shared capacity, goop credit and leaving. test_coop's crowd case now
  resets the loopback's drop counter so earlier traffic can't change
  which messages it loses.
- Docs: COOP.md and RULES.md no longer say the pouch is shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:06:25 -04:00
Forrest
ca8601029e Task #17: Propane Torch sprays a band of fire
Hit test: _band_hit replaces the torch's cone. It hits the enemies in a
torch_width (1.6 m) wide band along the gun's line, from the scarecrow's
center out to torch_range (4.5 m) past the muzzle, each enemy's hit radius
added. The nearest torch_targets with a clear line are hit; _cone_hit and
_band_hit share _hit_nearest. torch_arc is gone, and the torch joins
MUZZLE_WEAPONS so scripted aim matches the mouse.

Flame: TorchFlame (CPUParticles3D jet plus a flickering light) is sized to
the band. WeaponModels gains a reusable held-effect pattern for #18:
- add_held_effect / lit / douse / advance.
- attack() lights the effect for HOLD_TICKS (1.5) tick intervals instead
  of replaying the kick.
- douse() puts it out the moment fire is let go; it then fades for the
  particle lifetime.
- Timers run on the sim clock (ScarecrowCombat.tick), or on physics frames
  when nothing advances them. That covers the other scarecrow on the
  partner's machine, which the existing "attack" events light, so there is
  no protocol change.

Sound: a new burned signal and a "burn" cue (synth torch_roar.wav,
generated by synth_audio.gd with its own seed) replace the pitchfork's
stab sound.

Tests (test_weapons): band in, beside, behind and beyond; a melee hugger
is burned; held fire over 5 intervals ticks 5 times and stops on release;
the flame is lit at every step while held and hidden after release; the
replica and attack-event paths; the flame follows the model's yaw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 13:04:54 -04:00
Forrest
9cb01f1ede Task #19: UFO model built from primitives
UFOs no longer reuse the crow's bird mesh. EnemySystem.build_ufo_mesh()
merges the mesh arrays of two CylinderMesh hull halves, a TorusMesh rim, a
hemisphere SphereMesh dome and eight small sphere lights into one ArrayMesh
(about 1.65 m across, -0.13..0.45 m about its origin), with per-part vertex
colors and (glow, metalness) in UV.

A second HordeRenderer (ufo_renderer) draws it with the new
game/resources/ufo.gdshader: albedo from COLOR, no flap, a slow spin and bob
with a per-enemy phase, chasing rim lights, and the bird shader's hit flash
(INSTANCE_CUSTOM.g) and night_glow. Both batches mirror the dense slots
(write_new, move_slot, clear), and commit_render scales each slot to nothing
in the batch that doesn't draw its type. DayNight now takes a list of enemy
materials and sets night_glow on both.

UFOs get their own arrival cue (kenney/digital/powerUp2.ogg, previously
unused) instead of the crow's caw. HordeRenderer.is_drawn() backs the new
test_roster checks: a UFO is drawn by the UFO batch only, a crow by the
bird batch only, a thief by neither, also after a swap-removal; and the
saucer's size and centering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 12:55:14 -04:00
Forrest
4e3692b99d Merge task #9: Workbench arrives after Night 1, targetable, repair-only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 16:47:05 -04:00
Forrest
acf4e2f4c1 Task #9 follow-up: make the Workbench genuinely targetable (Decision 3)
FarmSim._breaker_goals() now treats an unbroken Workbench as guarding its
own work area unconditionally (not just when within guard_range of the
pen/shed/crop-field rects, which it normally isn't), alongside whatever
else actually guards something -- so it joins a non-empty guarding set
instead of only ever being a last-resort fallback. A broken Workbench (0
HP) drops out entirely: nothing left to gain by sending a breaker at it.

That alone wasn't enough in practice: the Workbench's footprint sits on
its own scene prop's real collision, which FarmNavigation.build() already
rasterized into blocked[] before any structure ever gets placed there --
unlike every player-placed structure, which validate()'s world-blocked
check keeps off already-blocked terrain. _rasterize_into() skipped tagging
structure_at[] on an already-blocked cell, so the Workbench was invisible
to ThiefBehavior._adjacent_structure() and FarmNavigation.barrier_ahead():
a fence breaker would walk right up to it and then just stand there,
forever stuck in SEEK, never transitioning to BREAK. Fixed by tagging
structure_at[] for a structure id even over a blocked cell; a terrain
block (id < 0) still skips already-blocked cells exactly as before, and
no existing (validate()-placed) structure's footprint was ever on blocked
terrain to begin with, so this changes nothing for fences, gates, traps,
or turrets.

test_structures.gd's Workbench check now proves targeting, not just
damage: with a real guarding structure also present (PenRing.build_gate_
only, the same single-barrier setup test_roster.gd's own fence-breaker
test uses) and the scarecrow kept well clear, a fence breaker spawned
with no hand-set state or barrier walks to and smashes the Workbench on
its own, and a broken Workbench is confirmed absent from the breaker
goals. Found by running the actual AI end to end (not by poking es.state/
es.barrier by hand, which only proves damage()).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 16:46:04 -04:00
Forrest
df10a1967c Task #9: Workbench auto-grants after Night 1, destructible/repairable
Gate the Workbench to appear once Night 1 is survived instead of being
buildable: StructureSystem.grant_workbench() (an unvalidated, unpurchased
place() variant, grant()) adds a "workbench" structure record at the scene
node's position, reusing the existing damage/repair/targeting/save pipeline
end to end. The grant happens on CampaignController.night_ending (so it
lands in state before the morning snapshot, like #13's crop growth) and is
re-derived from FarmState.nights_survived on load/retry (sync_from_state).

The Workbench's view is the scene's own node (hidden until granted, shown
by StructureSystem._add_view) instead of a second built mesh, so it gets
the standard HP bar, damage tint, and wobble for free. It's repair-only:
damage() never removes its record at 0 HP ("broken" instead of destroyed),
and it can't be dismantled. Interactions refuses to open its shop before
it exists or while broken (and no longer treats it as focusable), and
coop_session.gd's "buy" request handler refuses a workbench-shop item
(Upgrades.shop_of) the same way for a co-op partner. review_panel.gd's
pre-grant summary line no longer promises the work area from night one.

No FarmState.VERSION bump: a "workbench" record is a new type string, not
a new field, and from_dict() already validates types generically.

Tests: a new test_structures.gd check covers absent/no-prompt/shop-refused
before Night 1 (including a co-op "buy" request), granted after, damaged
by an enemy (thief_behavior.gd's generic BREAK state), broken-not-destroyed
at 0 HP with its shop refused, repaired at the normal proportional cost,
and persistence through a save/retry round trip. test_cycle.gd and
test_nights.gd pre-grant the workbench in setup (grant_workbench()) so
their per-night structure-count invariants aren't thrown off by the
night-1 grant itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 16:27:55 -04:00
Forrest
3e31afb2d9 Task #8: Radar item, a Supply Shed minimap reveal
Adds a Radar upgrade (hidden until enough Alien Goop is collected,
same as the Alien Ray; buyable at the supply shed for 8 scrap/6 wood)
and a RadarHud minimap, created in code under the Hud CanvasLayer
(top-right corner, under the materials readout): hidden until bought,
then draws the playable farm's outline with a dot for the scarecrow
and one per alive enemy within GameConfig.radar_range (40 m) of it,
redrawn every radar_refresh (0.25 s). New test_radar suite covers the
hidden/revealed/bought shop states, minimap visibility, in-range vs
out-of-range dot filtering, and upgrade ownership surviving a save
round trip.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 16:08:54 -04:00
Forrest
930647cccd Merge task #13: lettuce/cabbage and corn fields sprout after nights 2 and 4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:54:03 -04:00
Forrest
62edb8e04c 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>
2026-10-05 15:52:38 -04:00
Forrest
4b78004333 Merge task #10: per-instance Turret/Tar Patch leveling (L1-L3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:52:03 -04:00
Forrest
8d84373f54 Task #10 follow-up: bump co-op PROTOCOL for the avatar snapshot change
_put_avatar/_read_avatar's per-avatar record changed (one more time
field, two int32s, for the upgrade channel's target/progress), so an
older partner needs the hello/refused handshake to catch the mismatch
and refuse cleanly, rather than misparsing snapshots.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:51:45 -04:00
Forrest
62324ff4b1 Task #10: per-instance Turret/Tar Patch leveling (L1-L3)
Adds a per-placed-structure "level" (1-3) to automated_defense and
slowing_trap, upgraded independently (not account-wide) by holding
interact at that specific structure, by day, once it's undamaged
(repair still takes priority while it isn't), for a config-tunable
per-level cost.

Turret L2 fires turret_level_fire_mult (3x, matching the live Rapid
Fire multiplier) as often; L3 keeps that rate and fires
turret_l3_projectiles shots at once in a fan. A tar patch's trigger
footprint and visual grow by trap_level_size_mult per level (L2
double, L3 triple its L1 size); a bigger footprint that would overlap
a neighbor or the world refuses the upgrade with a reason.

FarmState.VERSION bumps 5->6 (STRUCTURE_KEYS gains "level"; migrate()
backfills level 1 on older saves, following the v2->v3 precedent for
night_log). Co-op: an upgrade is driven the same way repair already
is -- entirely host-side, off the partner's held interact button, no
new "req" case -- so the only wire change is forwarding the upgrade
channel's target/progress in the avatar snapshot, same as repair's.

New test_structures.gd coverage: fire interval and projectile count
per turret level, tar patch footprint per level, each proven
independently for two separately-placed structures of the same type,
plus the upgrade rules (repair-first, room, afford) and that level
survives a save/retry round trip.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:48:19 -04:00
Forrest
72e84f14e2 Merge task #7: Potato Cannon, Shurikens, Propane Torch, Alien Ray (shed weapons)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:40:51 -04:00
Forrest
b9dcd24b5d Task #7: four new shed weapons (Potato Cannon, Shurikens, Propane Torch, Alien Ray)
All four go in the main hand alongside the pitchfork and corn shooter, cooldown-based
with no ammo, every stat GameConfig-tunable: Potato Cannon is a slow heavy shot,
Shurikens a fast cheap throw, Propane Torch a sustained cone DoT while held (shares
the pitchfork's cone-hit test), and Alien Ray a fast powerful shot that stays hidden
in the shop until enough Alien Goop is collected. FarmProjectiles.fire() gained
optional speed/lifetime overrides (backward compatible) so each ranged weapon can fly
at its own pace. WeaponModels gained tinted placeholder pivots for the new weapons
(no new art), and the number-key switch loop and HUD panel layout were fixed to not
go out of bounds now that there are more main weapons than number keys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:39:56 -04:00
Forrest
b2eae679f8 Merge task #12: animals start loose (new LOOSE status), penned set persisted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:21:18 -04:00
Forrest
ffeec30873 Task #12 follow-up: theft alert for a claimed loose animal
AlertManager.collect() only raised the THEFT alert for a claimed
Status.HOME item; a thief that claimed a loose (Status.LOOSE) animal
raised no alert at all. The acceptance criteria call for loose animals
to behave per the existing theft rules, and the alert is part of that
UX, so treat LOOSE like HOME there too. Added a check to test_targets.gd
's _loose_start confirming a claimed loose animal raises the same THEFT
alert as a penned one (same AlertManager pattern test_roster.gd's
_alerts uses).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:20:58 -04:00
Forrest
308854d52c Task #6: Supply Shed as its own weapon shop, separate from the Workbench
Adds a second UpgradePanel instance (shop "shed") at the Supply Shed's new
ShedCounter node, opened by interact like the Workbench. corn_shooter and
pumpkin_bomb move there ("shop": "shed" in GameConfig.upgrades); the
Workbench's panel (shop "workbench", the default) keeps rapid_fire,
heavy_seeds, and the rest, with "requires" still crossing shops. Co-op buys
go through the same ["buy", id] host gate; a shed_requested signal mirrors
workbench_requested so the partner's own shed panel opens. The shed's
walk-in pouch deposit is unaffected (no interact, not gated by the
counter's reach).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 15:13:48 -04:00
Forrest
13efe6603f Task #12: animals start loose; herd into the player-built pen
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>
2026-10-05 15:13:20 -04:00
Forrest
5b72e830db Merge task #3: pouch 8 base, Bigger pouch upgrade to 16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:50:44 -04:00
Forrest
d0bb1f4433 Task #3: pouch capacity rework (8 base, 16 upgraded)
Base pouch_capacity drops from a flat 16 to 8 (GameConfig). A new
"pouch_upgrade" (Bigger pouch, Scarecrow track, wood 10 + straw 8)
raises it to 16, bought once at the workbench like straw_stuffing.
Upgrades.buy() special-cases "pouch_capacity" the same way it already
does scarecrow_max_hp, writing straight to the live ResourceStore
value so it carries into the next morning, survives a save, and
comes back with a retry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 14:50:15 -04:00
Forrest
ae894949e0 Merge task #15: UFO enemy (fast flying fighter), 7 in night 5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:47:10 -04:00
Forrest
34358d0641 Task #15: UFO enemy, a fast flying fighter
Adds a 4th enemy type (TYPE_UFO=3) that reuses the generic flying-nav
infrastructure (ignores fences, gates, and traps) and gets a new
FIGHT-capable behavior in ThiefBehavior: it skips SEEK/loot entirely and
goes straight to FIGHT, strafing the scarecrow in dive-and-pull-up passes
(diving to land_altitude while its attack is off cooldown, climbing to
cruise_altitude right after landing a hit) until it's hit for every pass.
All stats (speed 7.0, hp 2, damage 1, hit_interval 1.5s, aggro_range 10.0,
etc.) live in GameConfig.enemy_types["ufo"]. It renders through the same
shared flyer MultiMesh crows use (no new art) and is wired into
NightPlan/WaveDirector composition, the HUD/assessment roster lines, kill
log keys, and the arrival sound/toast, with a generic audio fallback since
it has no cue of its own.

Per a scope addition mid-task, night 5 now also sends in a wave of 4 UFOs
late in the night (game/resources/nights/night_5.tres), which shifts
test_nights' known-flaky "arrived" baseline line by one new {3: N} entry
(the UFO counts agree between plan and arrival) and required updating its
hardcoded "all three types" check to four. A debug-only "UFOs only"
scenario is added (game/resources/scenarios/ufos.tres) but deliberately
left out of CampaignDebug.SCENARIOS, since wiring it in would change
test_roster's hardcoded scenario count and that file's existing checks
were required to stay untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 14:43:46 -04:00
Forrest
d68d37b40f Merge task #5: hidden/reveal shop items gated on Alien Goop
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:40:37 -04:00
Forrest
45f3e83e54 Task #5: generic hidden/reveal shop item system
An item definition in GameConfig.upgrades can set "hidden": true
(optionally its own "reveal_goop", else the new config-tunable
hidden_reveal_goop) so the workbench shows only a bare "?" (no name,
text, or cost), disabled, until the player has collected that much
Alien Goop in total. Upgrades.goop_collected()/revealed() derive this
from FarmState.totals() (completed nights) plus night_events (the
current cycle), so it persists through save and retry without any new
stored state. blocker() and buy() both gate on it (covering the co-op
buy-request path too), and UpgradePanel.refresh() shows the "?" row.

No real upgrade ships hidden yet; #7/#8 (Alien Ray, Radar) will use
this mechanism. Test flags a duplicated long_range/sticky_tar hidden
to exercise it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 14:38:42 -04:00
Forrest
43300a15de Merge task #11: Animal Pen boundary is player-built
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:35:10 -04:00
Forrest
eb89268b66 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>
2026-10-05 14:34:02 -04:00
Forrest
1ab666e5e4 Task #4: Alien Goop resource and drop-on-kill from Aliens
Add alien_goop as a 4th ResourceStore material alongside wood/scrap/straw,
dropped only by killed Aliens (TYPE_THIEF) at a config-tunable rate/quantity
(GameConfig.alien_goop_drop_chance default 0.33, alien_goop_drop_qty default
1), credited straight into the pouch like a gathered material via a new
enemy_removed hook in FarmSim (seeded RNG for reproducible trials). It's
stealable from the shed through the existing most-stocked-material sack
mechanic once it outranks the others (ShedStock gets a placeholder front/
label spot for it, reusing the wood pile's proven-walkable spot; no new art).

ResourceStore.from_dict() now treats a shed/pouch entry missing a material
as 0 instead of rejecting it (old saves predate Alien Goop), and to_dict()
always fills in every material so round-trips are consistent regardless of
how the live dict was built; every method summing across MATERIALS reads
with get(m, 0) so a hand-built 3-key dict elsewhere doesn't error out.

New checks in test_economy.gd: _goop_persistence (retry discards goop
gained since the morning; the morning snapshot round-trips through JSON)
and _goop_drops (1000-kill statistical drop-rate check against config,
type restriction to Aliens only, pouch-capacity-respecting credit, and
shed-theft eligibility). Updated _state()'s and test_cycle.gd's hardcoded
3-key shed dicts for the new 4th material.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 14:23:22 -04:00
Forrest
814449afff Merge task #14: enemy roster display names (Alien / Alien robot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:51:27 -04:00
Forrest
a48762aa66 Fix wave_director entry_label: restore crop-target thief label, drop dead const
entry_label() dropped the CROP arm when the thief-wave labels were
reworded, so a thief wave targeting crops fell through to the generic
"Aliens" instead of naming its target. Add "Aliens after the crops" and
update the doc comment. Also delete TARGET_NAMES, left unused after that
rework (git grep confirms no other references).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 13:51:08 -04:00
Forrest
8146567aac Enemy roster reskin: thief -> Alien, breaker -> Alien Robot display names
Renames player-visible text only (toasts, HUD hints, wave labels, night
and scenario titles, tutorial tips, review/end panel text): thief/thieves
display as alien/aliens, fence breaker/fence breakers display as alien
robot/alien robots. Crows keep their name; night 1's dusk hint and night
3's hint get brief alien-mind-control framing. All TYPE_* ids, "thief"/
"breaker"/"crow" data keys, class/function/variable names, and code
comments are unchanged. Adds EnemySystem.ARTICLES so "a"/"an" still
agrees with the new names. Updates the two tests that assert the old
display strings (test_flow.gd, test_save.gd); test_roster.gd and
test_theft.gd are untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 13:48:00 -04:00
Forrest
47b860b1af Merge task #2: sprint rebalance to 1.8x / 4 s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:45:38 -04:00
Forrest
d66a8af330 Sprint rebalance: 1.6x/3s -> 1.8x/4s (spec values)
Updates sprint_speed_mult and sprint_time in game_config.gd to match
the spec (Decision 9 in alien-overhaul-plan.md); cooldown already
matched at 10s. Updates the Sprint upgrade description text in both
game_config.gd and game_config.tres to reflect the new numbers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 13:43:35 -04:00
Forrest
1b723eb925 Rename Turret/Tar Patch display labels
Change UI-visible names for automated_defense ("Turret") and
slowing_trap ("Tar patch") in StructureSystem.NAMES, plus the
matching upgrade descriptions in game_config.gd/.tres. Internal
dictionary keys/ids are unchanged for save compatibility.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 13:43:31 -04:00
Forrest
39f9d15cfe Co-op voice/session work, config retune, net budget tool, overhaul plan
Snapshot of in-progress work before the alien overhaul so worker
worktrees branch from current code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:35:53 -04:00
Forrest
2e6638b744 updates 2026-10-04 17:30:48 -04:00
Forrest
4298caf5cb updates 2026-10-04 12:07:36 -04:00
Forrest
276d43613d init 2026-10-03 12:14:28 -04:00