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
|
|
@ -1,10 +1,13 @@
|
|||
class_name UpgradePanel
|
||||
extends CenterContainer
|
||||
## The workbench's upgrade menu (Upgrades): one row per upgrade, by track, with what it does and
|
||||
## what it costs. A done one says so; one you can't afford says what's missing. It opens with
|
||||
## interact at the workbench by day (Interactions). Buy with a click, or the arrows / d-pad and
|
||||
## Enter / A. Close it with Close, Escape / B, interact again, by walking off, or at nightfall.
|
||||
## The scarecrow stands still and can't shoot while it's open.
|
||||
## A shop's menu (Upgrades): one row per upgrade or item sold by this instance's shop (shop,
|
||||
## Upgrades.shop_of), by track, with what it does and what it costs. A done one says so; one you
|
||||
## can't afford says what's missing. The work area's instance (shop "workbench": player/weapon
|
||||
## stat and buildable upgrades) opens with interact at the workbench by day; the supply shed's
|
||||
## (shop "shed": weapons and other purchasable items) opens with interact at the shed's counter by
|
||||
## day (Interactions). Buy with a click, or the arrows / d-pad and Enter / A. Close it with Close,
|
||||
## Escape / B, interact again, by walking off, or at nightfall. The scarecrow stands still and
|
||||
## can't shoot while either is open.
|
||||
|
||||
signal message(text: String, color: Color)
|
||||
signal bought(id: String)
|
||||
|
|
@ -13,6 +16,8 @@ var campaign: CampaignController
|
|||
var structures: StructureSystem
|
||||
var player: PlayerCharacter
|
||||
var is_open := false
|
||||
## Which shop this instance lists ("workbench" or "shed"); set by setup().
|
||||
var shop := "workbench"
|
||||
## Co-op partner: ask the host to buy (upgrade id); the result comes back as a message.
|
||||
var buy_request: Callable
|
||||
|
||||
|
|
@ -21,15 +26,16 @@ var _title: Label
|
|||
var _close: Button
|
||||
|
||||
|
||||
func setup(p_campaign: CampaignController, p_structures: StructureSystem, p_player: PlayerCharacter) -> void:
|
||||
func setup(p_campaign: CampaignController, p_structures: StructureSystem, p_player: PlayerCharacter, p_shop: String = "workbench") -> void:
|
||||
campaign = p_campaign
|
||||
structures = p_structures
|
||||
player = p_player
|
||||
shop = p_shop
|
||||
var box := get_node("Panel/Margin/Box") as VBoxContainer
|
||||
var track := ""
|
||||
for id in Upgrades.ORDER:
|
||||
var u: Dictionary = campaign.config.upgrades.get(id, {})
|
||||
if u.is_empty():
|
||||
if u.is_empty() or Upgrades.shop_of(campaign.config, id) != shop:
|
||||
continue
|
||||
if String(u.get("track", "")) != track:
|
||||
track = String(u.get("track", ""))
|
||||
|
|
@ -122,7 +128,8 @@ func refresh() -> void:
|
|||
if why != "" and why != "Done":
|
||||
b.text += " %s" % why
|
||||
b.disabled = why != ""
|
||||
_title.text = "Upgrades at the work area (%d of %d done)" % [done, _rows.size()]
|
||||
var place := "Upgrades at the work area" if shop == "workbench" else "Shop at the supply shed"
|
||||
_title.text = "%s (%d of %d done)" % [place, done, _rows.size()]
|
||||
|
||||
|
||||
func _buy(id: String) -> void:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue