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:
parent
1ccf825bbf
commit
308854d52c
17 changed files with 260 additions and 64 deletions
|
|
@ -135,10 +135,12 @@ func _requests() -> void:
|
|||
client.build.place_request.call("fence", 30.0, -30.0, 0)
|
||||
_pump(20)
|
||||
r.check(host.structures.count() == before + 1, "a placement out of the partner's reach is refused by the host")
|
||||
client.upgrade_panel.buy_request.call("corn_shooter")
|
||||
r.check(not host.upgrade_panel._rows.has("corn_shooter") and host.shed_panel._rows.has("corn_shooter"),
|
||||
"the corn shooter is sold at the supply shed's menu, not the workbench's (also on the partner's replica)")
|
||||
client.shed_panel.buy_request.call("corn_shooter")
|
||||
_pump(20)
|
||||
r.check(Upgrades.owned(host.campaign.state, "corn_shooter") and Upgrades.owned(client.campaign.state, "corn_shooter"),
|
||||
"the partner buys an upgrade at the workbench (the host does it)")
|
||||
"the partner buys a weapon at the supply shed (the host does it)")
|
||||
|
||||
|
||||
## Standing still by day: the clock runs, nothing else changes.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ extends RefCounted
|
|||
## The scarecrow's three weapons on the real farm (FarmSim stepped by hand at 60 Hz): only the
|
||||
## pitchfork to start; its stab (in reach and in the arc of the aim only, the nearest few, its
|
||||
## damage, once per interval, again and again while fire is held, not through a wall); the corn
|
||||
## shooter and pumpkin bombs bought at the workbench (rapid fire and heavy seeds need the corn
|
||||
## shooter first; a weapon bought goes into its hand, bombs into the off-hand); switching the main
|
||||
## shooter and pumpkin bombs bought at the supply shed, not the workbench (rapid fire and heavy
|
||||
## seeds, bought at the workbench, need the corn shooter first; a weapon bought goes into its
|
||||
## hand, bombs into the off-hand); switching the main
|
||||
## weapon (Tab / 1-2, owned ones only, not in build mode, never the bombs; one no longer owned
|
||||
## falls back to the pitchfork); the off-hand on its own button (right mouse / LT: with the main
|
||||
## weapon in hand, both at once, held, not with the right click that leaves build mode); a bomb's
|
||||
|
|
@ -132,17 +133,21 @@ func _unlocks(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
|
|||
r.check(Upgrades.blocker(c, "rapid_fire") == "Needs the corn shooter first" and Upgrades.buy(c, "heavy_seeds", st).contains("needs the corn shooter")
|
||||
and not Upgrades.owned(s, "heavy_seeds"), "rapid fire and heavy seeds need the corn shooter first")
|
||||
r.check(Upgrades.buy(c, "corn_shooter", st).contains("done:") and combat.owns(W.CORN_SHOOTER) and Upgrades.blocker(c, "rapid_fire") == "",
|
||||
"the corn shooter is bought at the workbench; then rapid fire can be")
|
||||
var panel := farm.get_node("Hud/UpgradePanel") as UpgradePanel
|
||||
"the corn shooter is bought at the supply shed; then rapid fire (at the workbench) can be")
|
||||
var bench_panel := farm.get_node("Hud/UpgradePanel") as UpgradePanel
|
||||
var panel := farm.get_node("Hud/ShedPanel") as UpgradePanel
|
||||
r.check(not bench_panel._rows.has("corn_shooter") and not bench_panel._rows.has("pumpkin_bomb")
|
||||
and panel._rows.has("corn_shooter") and panel._rows.has("pumpkin_bomb"),
|
||||
"the weapons are sold at the supply shed's menu, not the workbench's")
|
||||
panel._buy("pumpkin_bomb")
|
||||
r.check(combat.owns(W.PUMPKIN_BOMB) and combat.offhand == W.PUMPKIN_BOMB and combat.weapon == W.PITCHFORK,
|
||||
"pumpkin bombs bought from the menu go into the off-hand, the pitchfork staying in hand")
|
||||
"pumpkin bombs bought from the shed's menu go into the off-hand, the pitchfork staying in hand")
|
||||
var pivots := combat.models._pivots
|
||||
r.check(pivots[2].visible and pivots[0].visible and not pivots[1].visible, "both show on the scarecrow")
|
||||
r.check(pivots[0].position.x > 0.0 and pivots[2].position.x < 0.0, "the pitchfork in the right hand, the pumpkin in the left")
|
||||
s.upgrades.erase("corn_shooter")
|
||||
panel._buy("corn_shooter")
|
||||
r.check(combat.weapon == W.CORN_SHOOTER and combat.offhand == W.PUMPKIN_BOMB, "the corn shooter bought from the menu goes into the hand")
|
||||
r.check(combat.weapon == W.CORN_SHOOTER and combat.offhand == W.PUMPKIN_BOMB, "the corn shooter bought from the shed's menu goes into the hand")
|
||||
|
||||
|
||||
func _switching(r: GameTestRunner, sim: FarmSim) -> void:
|
||||
|
|
@ -308,7 +313,7 @@ func _hud(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
|
|||
hud._process(0.0)
|
||||
var rows: Array = hud._weapon_rows.map(func(l: Label) -> String: return l.text)
|
||||
var off: Array = hud._offhand_rows.map(func(l: Label) -> String: return l.text)
|
||||
r.check(rows == ["1 Pitchfork", "2 Corn shooter (workbench)"], "the HUD lists the main weapons by number: %s" % [rows])
|
||||
r.check(rows == ["1 Pitchfork", "2 Corn shooter (supply shed)"], "the HUD lists the main weapons by number: %s" % [rows])
|
||||
r.check(charged == ["Pumpkin bombs"] and off == ["Pumpkin bombs %.0f s" % ceilf(cfg.bomb_cooldown)],
|
||||
"and the off-hand's bombs, with their recharge: %s, %s" % [charged, off])
|
||||
r.check(hud._weapon_title.visible and hud._weapon_hint.text.contains("Tab") and hud._offhand_title.text.contains("right mouse"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue