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

@ -8,7 +8,9 @@ extends RefCounted
## Goop (#4): dropped only by killed Aliens (thieves) at a config-tunable rate, credited like a
## gathered material, stealable from the shed once it's the stock on top, and surviving retry,
## and hidden/reveal shop items (#5): an item flagged "hidden" shows only "?" and can't be bought
## until enough Alien Goop has been collected in total, then shows and buys normally.
## until enough Alien Goop has been collected in total, then shows and buys normally; and the
## supply shed's own shop (#6): weapons (corn_shooter, pumpkin_bomb) bought at its counter
## (ShedCounter), not the workbench, with the walk-in pouch deposit unaffected.
const P := CampaignController.Phase
const DT := 1.0 / 60.0
@ -33,6 +35,7 @@ func run(r: GameTestRunner) -> void:
_deposit_and_night(r, sim, player)
_patch_cost(r, sim)
_stuffing(r, sim, player)
_shed_shop(r, sim, player)
_goop_drops(r, sim)
farm.queue_free()
await r.process_frame
@ -415,6 +418,43 @@ func _stuffing(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void
menu.close()
## #6: weapons (corn_shooter, pumpkin_bomb) moved to their own shop at the supply shed's counter
## (ShedCounter, shop "shed"), separate from the workbench's upgrade menu; buying one there works
## the same way, and the shed's walk-in pouch deposit still needs no interact and isn't gated by
## the counter's reach or its shop being open.
func _shed_shop(r: GameTestRunner, sim: FarmSim, player: PlayerCharacter) -> void:
var c := sim.campaign
var s := c.state
var it := sim.interactions
var counter := it.shed_counter
var bench_menu := sim.upgrade_panel
var menu := sim.shed_panel
r.check(counter != null and menu != null, "the supply shed has its own counter and shop menu")
r.check(not bench_menu._rows.has("corn_shooter") and not bench_menu._rows.has("pumpkin_bomb")
and menu._rows.has("corn_shooter") and menu._rows.has("pumpkin_bomb"),
"the workbench no longer sells the weapons; the shed's menu does")
s.upgrades.erase("corn_shooter")
s.resources.shed = {"wood": 4, "scrap": 10, "straw": 0}
player.global_position = counter.global_position + Vector3(0.0, 0.0, 1.2)
_press(sim)
r.check(menu.is_open and not bench_menu.is_open and player.rooted and not it.can_shoot(),
"interact at the shed counter opens the shed's shop, not the workbench's")
var row := menu._rows["corn_shooter"] as Button
row.pressed.emit()
r.check(Upgrades.owned(s, "corn_shooter") and s.resources.shed == {"wood": 0, "scrap": 0, "straw": 0},
"buying the corn shooter from the shed's menu works, for its usual cost")
_press(sim)
r.check(not menu.is_open and not player.rooted, "interact again closes the shed's shop")
var shed_zone := sim.zones.zone(FarmZone.Kind.SUPPLY_SHED)
player.global_position = Vector3(shed_zone.global_position.x, 0.0, shed_zone.global_position.z - 4.0)
r.check(Vector2(player.global_position.x, player.global_position.z).distance_to(Vector2(counter.global_position.x, counter.global_position.z)) > counter.reach,
"well outside the counter's reach, but still in the shed")
s.resources.pouch = {"wood": 2, "scrap": 0, "straw": 0}
_step(sim, 1)
r.check(s.resources.pouch.get("wood", 0) == 0 and s.resources.shed.get("wood", 0) == 2,
"walking into the shed zone still auto-deposits the pouch, away from the counter and with its shop closed")
## Alien Goop (#4): dropped only by killed Aliens (thieves), at GameConfig's rate and quantity,
## credited like a gathered material (respecting the pouch's capacity), and stealable from the
## shed like any other material once it's the one on top.