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>
42 lines
1.4 KiB
GDScript
42 lines
1.4 KiB
GDScript
class_name ShedCounter
|
|
extends Node3D
|
|
## The supply shed's purchase counter, where the scarecrow buys weapons and other items sold
|
|
## there (Upgrades, UpgradePanel, shop "shed"): press interact here by day to open the shed's
|
|
## shop. Its label shows how many of the shed's items are done. Separate from the shed's walk-in
|
|
## pouch drop-off (Interactions.step, FarmZone.Kind.SUPPLY_SHED), which needs no interact and has
|
|
## no counter of its own.
|
|
|
|
## How close the scarecrow's center has to be to this node's origin.
|
|
@export var reach: float = 2.2
|
|
|
|
var _label: Label3D
|
|
|
|
|
|
func _ready() -> void:
|
|
_label = Label3D.new()
|
|
_label.billboard = BaseMaterial3D.BILLBOARD_ENABLED
|
|
_label.no_depth_test = true
|
|
_label.shaded = false
|
|
_label.font_size = 40
|
|
_label.outline_size = 10
|
|
_label.pixel_size = 0.0075
|
|
_label.modulate = Color(0.85, 0.75, 1.0)
|
|
_label.position = Vector3(0.0, 2.2, 0.0)
|
|
_label.visible = false
|
|
add_child(_label)
|
|
|
|
|
|
func show_state(campaign: CampaignController, show: bool, focused: bool) -> void:
|
|
_label.visible = show
|
|
if not show:
|
|
return
|
|
var done := 0
|
|
var total := 0
|
|
for id in Upgrades.ORDER:
|
|
if Upgrades.shop_of(campaign.config, id) != "shed":
|
|
continue
|
|
total += 1
|
|
if Upgrades.owned(campaign.state, id):
|
|
done += 1
|
|
var hint := ("[E / X] Shop" if campaign.is_daytime() else "Shop by day") if focused else "Shop"
|
|
_label.text = "%s\n%d of %d done" % [hint, done, total]
|