The workbench label, the morning screen and the end screen counted an
upgrade as done at level 1 ("N of 17"); they now count levels bought
(Upgrades.levels_bought / levels_total). Pumpkin bombs arrive at the shed
on day 3, so the first-morning text and the shoot tip say more weapons
arrive over the days instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Workbench stat upgrades get 3 levels: level L costs costs[id] x
upgrade_cost_growth (1.8) ^ (L - 1), each material rounded up, and opens on
day upgrade_level_days[L - 1] ([1, 8, 16]). Each owned level's "mult"/"add"
entry stacks. Level 1 keeps the user's values and costs (rapid fire 3.0x).
Shed items arrive on set days ("from_day"): corn shooter 1, shurikens 2,
pumpkin bombs 3, potato cannon 6, radar 8, propane torch 10, alien ray 14.
- Upgrades: level(), max_level(), maxed(), cost(cfg, id, level),
next_cost(), per_level(), text_at(), name_at() (roman numerals),
from_day(), level_day(), arrived(). owned() stays "level >= 1". blocker()
adds "Arrives on day N" and "Level N opens on day D"; buy() takes the next
level and applies that level's side effect; upgrades_bought counts every
level. FarmState.upgrades keeps id -> level, so saves don't change shape.
- UpgradePanel: "Rapid fire II" with the next level's text and cost, the
blocker reason, "Max" at the last level; a shed item before its day shows
its name greyed with "Arrives on day N" ("?" plus the day if hidden). The
title counts items at their last level. Every level bought jingles.
- Co-op: the host sends "bought" for any level (no wire change; PROTOCOL
stays 5).
- soak_night.gd buys the lowest next level first across UPGRADE_ORDER.
- Tests: level costs, day gates, stacking, from_day, save/morning/retry/co-op,
an old {"rapid_fire": 1} save as level 1. Existing tests set the day where
they buy stock that now arrives later.
- RULES.md Upgrades: per-level effects and costs, stock schedule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A planned ground arrival whose type has no free character used to be
skipped (spawn_skipped) and lost. Now it waits and comes in as soon as
one frees, without holding back other types; any still waiting at
sunrise are dropped and counted.
- EnemySystem.can_spawn(type): room and, on foot, a free character
(EnemyCharacters.has_free; a corpse counts), no side effects.
- WaveDirector.step: due arrivals that can't spawn go to a per-type
FIFO; waiting ones are admitted first each tick. waited / dropped
counters next to spawned, reset at nightfall; waiting() for tests.
- GameConfig.character_pool {"thief": 48, "breaker": 20} replaces
EnemyCharacters.POOL; the pools are built from it at setup.
- RULES.md, Night plans: the real limits and the waiting rule.
- test_roster: full thief pool -> the thief waits, crows stay on time,
a freed character (corpse) lets it in, sunrise drops and counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Plans load by count: FarmSim.night_plan_path(n) ("res://game/resources/nights/night_%d.tres")
for n in 1..campaign_nights (FarmSim.load_night_plans). A missing file is a push_error and
that night plays the last plan that loaded. FarmSim.NIGHT_PLANS is gone. campaign_nights
stays 5.
- NightPlan.enemy_speed_scale / enemy_hp_scale (default 1; problems() flags non-positive ones).
At nightfall WaveDirector._on_phase_changed hands tonight's plan (or the F2 debug plan) to
EnemySystem.night_speed_scale / night_hp_scale, and the morning puts them back to 1.
EnemySystem.full_hp(type) = maxi(t_hp, floori(t_hp * night_hp_scale)) at spawn; steering
and max_speed() use t_speed * night_speed_scale (fleeing and carrying are shares of it).
Enemies have no HP bar (only structures do), and the co-op replica never simulates enemy HP,
so the wire format and CoopSession.PROTOCOL (5) are unchanged.
- Debug F3 / Shift+F3 (CampaignDebug.jump_morning; debug builds, morning review only, not on
a co-op partner's machine): next / previous day's morning with the farm as it is and
nights_survived = night - 1. It grants the Workbench and grows crops_total as a night's end
does, then re-enters the morning through CampaignController.load_state with save_path
blanked, so there's no autosave.
- test_nights: plan paths load in order (and a missing one repeats the last), spawn HP and
speed at default and 1.6 scales, and the F3 / Shift+F3 jump.
- RULES.md (The enemies: per-night scales), PLAYTEST.md (NIGHT_PLANS note), GameConfig
campaign_nights comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The user asked to drop the pop-up status lines, including replies to the
player's own actions.
- farm.tscn (edited as text): the ZoneBanner and Hud/ToastFeed nodes, their
ext_resources, and FarmSim's toasts export are gone. zone_banner.gd and
toast_feed.gd (with their .uid files) are deleted.
- FarmSim: no toast wiring, no arrival_message, no outside-the-fence or
sunrise lines. Main: no lobby-failure or microphone lines; _set_hud only
hides Hud. CampaignDebug: F2 no longer toasts (the F1 readout shows the
scenario).
- CoopSession: the host no longer sends "toast" or "arrived" events, and
the partner no longer handles them. The joined/left/version lines are gone
(the partner's main menu still says why a session ended). A refused
build request still sends the error sound. PROTOCOL stays 5: the other
messages and records are unchanged, and _apply_event ignores unknown
kinds, so mixed builds still work together.
- BuildMode.message is removed (no test listens to it). Interactions.message
and UpgradePanel.message stay because tests listen to them.
- test_farm_layout: the banner checks are removed.
- RULES.md, README.md, COOP.md, and LAYOUT.md no longer describe the banner
or toasts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
Held beam ticking every alien_ray_tick_interval, clipped at walls,
hitting up to alien_ray_pierce enemies along it (EnemySystem.path_hits);
AlienBeam visual on the held-effect pattern from #17; zap cue.
alien_ray_speed/lifetime/cooldown replaced by range/width/tick/pierce.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
Map size and perimeter, zone table (new fields; Work Area rect corrected
to the scene's), a "later fields" section, South Fields, travel-time and
edge tables re-measured, nav cell count and rebuild timings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 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>
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>
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>
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>
Second HordeRenderer with its own ufo.gdshader (vertex colors, spin,
chasing rim lights, hit flash, night glow); UFO arrival cue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Seven playtest issues traced to root causes: per-player co-op pouch,
Propane Torch band of fire, Alien Ray beam, primitive UFO model, crop
fields on the south soil with their own plant models, free-roaming
animals, and the joining player's store.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
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>
_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>
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>