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

@ -162,6 +162,7 @@ func start_host(p_sim: FarmSim, p_link: CoopLink, p_my_name: String, p_partner_n
_hook(sim.bombs.thrown, func(from: Vector3, to: Vector3) -> void: _events.append(["bomb", from, to]))
_hook(a.interactions.message, func(text: String, color: Color) -> void: _events.append(["toast", text, color]))
_hook(a.interactions.workbench_requested, func() -> void: _events.append(["workbench"]))
_hook(a.interactions.shed_requested, func() -> void: _events.append(["shed"]))
_hook(a.interactions.gathered, func(m: String, amount: int, n: GatherNode) -> void:
_events.append(["popup", "+%d %s" % [amount, m], n.global_position + Vector3(0.0, n.top() + 1.4, 0.0), GatherNode.COLORS[m]]))
_hook(a.kit.patch_denied, func(missing: Dictionary) -> void:
@ -206,6 +207,8 @@ func start_client(p_sim: FarmSim, p_link: CoopLink, p_my_name: String) -> void:
sim.build.dismantle_request = func(id: int) -> void: _request(["dismantle", id])
if sim.upgrade_panel != null:
sim.upgrade_panel.buy_request = func(id: String) -> void: _request(["buy", id])
if sim.shed_panel != null:
sim.shed_panel.buy_request = func(id: String) -> void: _request(["buy", id])
if sim.audio != null:
sim.audio.remote_cues = true
if sim.tutorial != null:
@ -624,6 +627,8 @@ func _apply_state(d: Dictionary, everything: bool = false) -> void:
sim.shed_stock.refresh()
if sim.upgrade_panel != null and sim.upgrade_panel.is_open:
sim.upgrade_panel.refresh()
if sim.shed_panel != null and sim.shed_panel.is_open:
sim.shed_panel.refresh()
if c.state.phase == CampaignController.Phase.MORNING and sim.review_panel != null:
sim.review_panel.refresh()
@ -682,6 +687,9 @@ func _apply_event(e: Array) -> void:
"workbench":
if sim.upgrade_panel != null and c.is_daytime():
sim.upgrade_panel.open()
"shed":
if sim.shed_panel != null and c.is_daytime():
sim.shed_panel.open()
func _apply_snap(data: PackedByteArray) -> void:
@ -766,7 +774,7 @@ func _apply_avatar(a: Avatar, rec: Dictionary) -> void:
var ch := String(rec["ch"])
if ch != "" and (not body.rooted or body.channel_clip != StringName(ch)):
body.start_channel(StringName(ch))
elif ch == "" and body.rooted and not (sim.upgrade_panel != null and sim.upgrade_panel.is_open):
elif ch == "" and body.rooted and not sim._menu_open():
body.stop_channel()
var it := a.interactions
it.focus = _gather_node(String(rec["fo"]))
@ -880,7 +888,7 @@ func _reset_world() -> void:
## replaced soon; standing still sends little).
func _send_input() -> void:
var a := sim.local_avatar
var ui := sim.upgrade_panel != null and sim.upgrade_panel.is_open
var ui := sim._menu_open()
var rec := _sender.record(a.combat, a.body, sim.build.active, ui, sim.local_frozen)
if rec != _last_input or _input_age >= INPUT_KEEPALIVE - 0.001: # (sums of 1/60 fall a hair short)
_last_input = rec
@ -894,16 +902,20 @@ func _unhandled_input(event: InputEvent) -> void:
_sender.note(event)
## The upgrade menu closes here on the same rules as solo (Interactions): walking off,
## nightfall, build mode.
## Either shop's menu closes here on the same rules as solo (Interactions): walking off its
## counter's reach, nightfall, build mode.
func _close_menu_if_needed() -> void:
var panel := sim.upgrade_panel
_close_menu(sim.upgrade_panel, sim.interactions.workbench)
_close_menu(sim.shed_panel, sim.interactions.shed_counter)
## counter: Workbench or ShedCounter (both just need global_position and reach).
func _close_menu(panel: UpgradePanel, counter) -> void:
if panel == null or not panel.is_open:
return
var bench := sim.interactions.workbench
var p := sim.local_avatar.position()
if not sim.campaign.is_daytime() or sim.build.active or bench == null \
or Vector2(bench.global_position.x, bench.global_position.z).distance_to(p) > bench.reach + 0.5:
if not sim.campaign.is_daytime() or sim.build.active or counter == null \
or Vector2(counter.global_position.x, counter.global_position.z).distance_to(p) > counter.reach + 0.5:
panel.close()