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
|
|
@ -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