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>
This commit is contained in:
Forrest 2026-10-05 15:13:48 -04:00
parent 1ccf825bbf
commit 308854d52c
17 changed files with 260 additions and 64 deletions

View file

@ -1,15 +1,18 @@
class_name Upgrades
extends RefCounted
## The work area's upgrades (definitions in GameConfig.upgrades, costs in GameConfig.costs):
## bought once each, by day, at the workbench's menu (UpgradePanel), and kept in
## FarmState.upgrades (id -> 1), so they carry over between nights and come back with a retry.
## Systems ask value() for a stat with the owned upgrades applied instead of reading GameConfig
## directly: the corn shooter's fire rate and shot damage, fear's radius and cooldown, fences' and gates'
## health (barrier_hp), the automated defense's range, and the traps' slow time. Straw stuffing
## raises the scarecrow's max health (FarmState) when bought, and the Bigger pouch upgrade raises
## pouch_capacity (ResourceStore) the same way. Sprint, the corn shooter, and pumpkin bombs change
## no stat: owning them unlocks sprinting (PlayerCharacter) and the two weapons (ScarecrowCombat).
## Rapid fire and heavy seeds need the corn shooter first ("requires").
## The farm's upgrades and shop items (definitions in GameConfig.upgrades, costs in
## GameConfig.costs): bought once each, by day, at one of two shops (shop_of, "workbench" by
## default: player/weapon stat and buildable upgrades, at the work area; "shed": weapons and
## other purchasable items, at the supply shed's counter), each its own UpgradePanel instance.
## Bought ones are kept in FarmState.upgrades (id -> 1), so they carry over between nights and
## come back with a retry. Systems ask value() for a stat with the owned upgrades applied instead
## of reading GameConfig directly: the corn shooter's fire rate and shot damage, fear's radius and
## cooldown, fences' and gates' health (barrier_hp), the automated defense's range, and the traps'
## slow time. Straw stuffing raises the scarecrow's max health (FarmState) when bought, and the
## Bigger pouch upgrade raises pouch_capacity (ResourceStore) the same way. Sprint, the corn
## shooter, and pumpkin bombs change no stat: owning them unlocks sprinting (PlayerCharacter) and
## the two weapons (ScarecrowCombat). Rapid fire and heavy seeds (bought at the workbench) need
## the corn shooter (bought at the shed) first ("requires" crosses shops freely).
## Menu order, grouped by track.
const ORDER: Array[String] = ["corn_shooter", "rapid_fire", "heavy_seeds", "pumpkin_bomb", "wide_fear", "quick_fear",
@ -24,6 +27,14 @@ static func cost(cfg: GameConfig, id: String) -> Dictionary:
return cfg.costs.get(id, {})
## Which shop sells an upgrade: "workbench" (the default: player/weapon stat and buildable
## upgrades, at the work area) or "shed" (weapons and other purchasable items, at the supply
## shed's counter). UpgradePanel filters ORDER by this to build the two shops' rows; "requires"
## can still cross shops (e.g. rapid_fire at the workbench requiring corn_shooter from the shed).
static func shop_of(cfg: GameConfig, id: String) -> String:
return String(cfg.upgrades.get(id, {}).get("shop", "workbench"))
## Total Alien Goop collected this vacation so far: every completed night's "gathered_alien_goop"
## (FarmState.totals(), from night_log) plus the current cycle's own count (night_events). This is
## a running total, not a current balance (spending or being robbed of goop doesn't un-reveal