Task #23: remove the zone banner and the message feed

The user asked to drop the pop-up status lines, including replies to the
player's own actions.

- farm.tscn (edited as text): the ZoneBanner and Hud/ToastFeed nodes, their
  ext_resources, and FarmSim's toasts export are gone. zone_banner.gd and
  toast_feed.gd (with their .uid files) are deleted.
- FarmSim: no toast wiring, no arrival_message, no outside-the-fence or
  sunrise lines. Main: no lobby-failure or microphone lines; _set_hud only
  hides Hud. CampaignDebug: F2 no longer toasts (the F1 readout shows the
  scenario).
- CoopSession: the host no longer sends "toast" or "arrived" events, and
  the partner no longer handles them. The joined/left/version lines are gone
  (the partner's main menu still says why a session ended). A refused
  build request still sends the error sound. PROTOCOL stays 5: the other
  messages and records are unchanged, and _apply_event ignores unknown
  kinds, so mixed builds still work together.
- BuildMode.message is removed (no test listens to it). Interactions.message
  and UpgradePanel.message stay because tests listen to them.
- test_farm_layout: the banner checks are removed.
- RULES.md, README.md, COOP.md, and LAYOUT.md no longer describe the banner
  or toasts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-06 16:02:37 -04:00
parent 6a9575dfe4
commit 1e91ccf594
18 changed files with 37 additions and 286 deletions

View file

@ -11,10 +11,9 @@ extends Node3D
## cancel leaves build mode.
## The scarecrow doesn't shoot, gather, or repair while building (FarmSim, Interactions).
## Co-op, on the partner's machine: placing and dismantling are sent to the host (place_request,
## dismantle_request), which checks them again and does them; the result comes back as a message.
## dismantle_request), which checks them again and does them.
## The cost is checked against (and paid from) the builder's own pouch and the shed (kit.slot).
signal message(text: String, color: Color)
signal toggled(on: bool)
## A placement was refused (the reason); a structure was taken down.
signal refused(reason: String)
@ -122,10 +121,8 @@ func step(_dt: float) -> void:
hover = -1
return
var e := campaign.state.structure(hover)
var back := structures.dismantle(hover)
structures.dismantle(hover)
dismantled.emit(String(e["type"]))
message.emit("Dismantled the %s%s" % [StructureSystem.NAMES[e["type"]].to_lower(),
(": %s back in the shed" % ResourceStore.describe(back)) if not back.is_empty() else ""], Color(0.85, 0.95, 1.0))
hover = -1
return
reason = structures.validate(type(), cursor.x, cursor.y, rot, me, kit.slot)
@ -134,9 +131,7 @@ func step(_dt: float) -> void:
place_request.call(type(), cursor.x, cursor.y, rot)
elif reason == "":
structures.place(type(), cursor.x, cursor.y, rot, kit.slot)
message.emit("Built a %s" % StructureSystem.NAMES[type()].to_lower(), Color(0.6, 1.0, 0.55))
else:
message.emit(reason, Color(1.0, 0.8, 0.5))
refused.emit(reason)
elif p[&"cancel"]:
set_active(false)

View file

@ -84,8 +84,6 @@ func cycle_scenario() -> void:
if _scenario >= 0:
plan = load("res://game/resources/scenarios/%s.tres" % SCENARIOS[_scenario]) as NightPlan
sim.waves.debug_plan = plan
if sim.toasts != null:
sim.toasts.push("Tonight (debug): %s" % (plan.title if plan != null else "the night's own plan"), Color(0.8, 0.9, 1.0))
func _describe() -> String:

View file

@ -10,8 +10,8 @@ extends Node
## welcome (reliable, once) the farm state, the phase, tonight's time, the loot, the names
## refused (reliable) the partner's game speaks another PROTOCOL
## batch (reliable, each tick with news) events in order: phase changes (with the state),
## the end of the campaign, sounds, toasts for the partner, loot and arrival news,
## breaches, fear bursts, gather popups, opening a shop's menu (the workbench's, the
## the end of the campaign, sounds, loot news, breaches, fear bursts, attacks,
## pumpkin bombs thrown, gather popups, opening a shop's menu (the workbench's, the
## shed's), a purchase the partner made (bought: the slot and the upgrade id, so a
## new weapon goes into its hand); enemies removed
## state (reliable, at most STATE_HZ, when it changed) the farm state (the phase clock
@ -158,9 +158,6 @@ func start_host(p_sim: FarmSim, p_link: CoopLink, p_my_name: String, p_partner_n
_hook(sim.enemies.enemy_removed, func(h: int, reason: EnemySystem.Removal, x: float, z: float, _c: int, _t: int) -> void:
_removed.append([h, int(reason), x, z])
_foe_sent.erase(h))
_hook(sim.waves.arrived, func(h: int, at: Vector2) -> void:
var d := sim.enemies.resolve_handle(h)
_events.append(["arrived", sim.enemies.type[d] if d >= 0 else 0, at]))
_hook(sim.loot.loot_event, func(kind: StringName, id: int, at: Vector3) -> void:
_events.append(["loot", String(kind), id, at]))
_hook(sim.structures.destroyed, func(id: int, type: String, at: Vector3) -> void:
@ -170,21 +167,16 @@ func start_host(p_sim: FarmSim, p_link: CoopLink, p_my_name: String, p_partner_n
_hook(av.kit.fear_used, func(_p: Vector3, _n: int) -> void: _events.append(["fear", slot]))
_hook(av.combat.attacked, func(w: ScarecrowCombat.Weapon) -> void: _events.append(["attack", slot, int(w)]))
_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:
_events.append(["toast", "Not enough straw to patch up: need %s more" % ResourceStore.describe(missing), Color(1.0, 0.8, 0.5)]))
if sim.audio != null:
sim.audio.forward = func(cue: String, at: Vector3) -> void: _events.append(["sound", cue, at])
_ensure_coop()
_state_hash = 0
_loot_hash = 0
_welcome_sent = false # sent when the partner says hello (then it is surely listening)
if sim.toasts != null:
sim.toasts.push("%s joined: player 2's scarecrow is on the farm" % _display(partner_name, "P2"), Avatar.COLORS[1])
partner_joined.emit(partner_name)
@ -249,14 +241,9 @@ func stop(reason: String = "") -> void:
sim.audio.forward = Callable()
if was == Role.HOST:
var gone_name := partner_name
var left_behind := sim.remove_partner() # their pouch, now in the shed
sim.remove_partner() # their pouch goes into the shed
sim.avatars[0].player_name = ""
sim.player.set_tag("", Color.WHITE)
if sim.toasts != null:
var text := "%s left: you're on your own" % _display(gone_name, "Player 2")
if not left_behind.is_empty():
text += " (%s from their pouch is in the shed)" % ResourceStore.describe(left_behind)
sim.toasts.push(text, Color(1.0, 0.8, 0.5))
partner_left.emit(gone_name)
else:
ended.emit(reason)
@ -503,10 +490,7 @@ func _host_message(kind: String, data: Variant) -> void:
partner_name = String(hello.get("name", partner_name))
if int(hello.get("v", 1)) != PROTOCOL:
link.send("refused", {"v": PROTOCOL}, true)
var who := _display(partner_name, "Your friend")
stop()
if sim.toasts != null:
sim.toasts.push("%s has another version of the game: update both to play together" % who, Color(1.0, 0.6, 0.4))
return
a.player_name = partner_name
_tag_all()
@ -546,25 +530,19 @@ func _do_request(r: Array) -> void:
var why := sim.structures.validate(type, x, z, rot, a.position(), a.slot)
if why == "":
sim.structures.place(type, x, z, rot, a.slot) # paid from P2's pouch, then the shed
_events.append(["toast", "Built a %s" % StructureSystem.NAMES[type].to_lower(), Color(0.6, 1.0, 0.55)])
else:
_events.append(["toast", why, Color(1.0, 0.8, 0.5)])
_events.append(["sound", "error", Vector3.INF])
"dismantle":
var e := c.state.structure(int(r[1]))
if e.is_empty() or a.position().distance_to(Vector2(e["x"], e["z"])) > sim.config.build_range:
return
var back := sim.structures.dismantle(int(r[1]))
_events.append(["toast", "Dismantled the %s%s" % [StructureSystem.NAMES[e["type"]].to_lower(),
(": %s back in the shed" % ResourceStore.describe(back)) if not back.is_empty() else ""], Color(0.85, 0.95, 1.0)])
sim.structures.dismantle(int(r[1]))
"buy":
var id := String(r[1])
if Upgrades.shop_of(c.config, id) == "workbench" and (sim.structures == null or not sim.structures.workbench_available()):
_events.append(["toast", "The work area isn't available", Color(1.0, 0.8, 0.5)])
return
var was := Upgrades.owned(c.state, id)
var text := Upgrades.buy(c, id, sim.structures, a.slot) # paid from P2's pouch, then the shed
_events.append(["toast", text, Color(0.85, 0.75, 1.0) if text.contains("done:") else Color(1.0, 0.8, 0.5)])
Upgrades.buy(c, id, sim.structures, a.slot) # paid from P2's pouch, then the shed
if not was and Upgrades.owned(c.state, id):
_events.append(["bought", a.slot, id]) # the buyer's game: a new weapon into its hand
@ -626,8 +604,6 @@ func _welcome_received(w: Dictionary) -> void:
if sim.day_night != null:
sim.day_night.snap()
_is_welcomed = true
if sim.toasts != null:
sim.toasts.push("Joined %s's farm: you're player 2" % _display(partner_name, "the host"), Avatar.COLORS[1])
welcomed.emit()
@ -697,14 +673,8 @@ func _apply_event(e: Array) -> void:
"sound":
if sim.audio != null:
sim.audio.play_remote(String(e[1]), e[2])
"toast":
if sim.toasts != null:
sim.toasts.push(String(e[1]), e[2])
"loot":
sim.loot.loot_event.emit(StringName(e[1]), int(e[2]), e[3])
"arrived":
if sim.toasts != null:
sim.toasts.push(FarmSim.arrival_message(int(e[1]), sim.zones.side_of(e[2])), Color(1.0, 0.75, 0.55))
"destroyed":
sim.structures.show_debris(e[3])
sim.structures.destroyed.emit(int(e[1]), String(e[2]), e[3])
@ -995,7 +965,3 @@ func _hook(sig: Signal, callable: Callable) -> void:
func _tag_all() -> void:
for a in sim.avatars:
a.body.set_tag(a.label(), a.color())
static func _display(n: String, fallback: String) -> String:
return n if n != "" else fallback

View file

@ -39,7 +39,6 @@ const NIGHT_PLANS: Array[String] = [
@export var zones: FarmZones
@export var player: PlayerCharacter
@export var camera: Camera3D
@export var toasts: ToastFeed
@export var alerts: AlertManager
@export var hud: ScarecrowHud
@export var end_panel: EndPanel
@ -322,24 +321,6 @@ func _ready() -> void:
campaign.phase_changed.connect(_on_phase_changed)
campaign.night_ending.connect(_on_night_ending)
if toasts != null:
toasts.loot = loot
loot.loot_event.connect(toasts.on_loot_event)
interactions.message.connect(toasts.push)
if upgrade_panel != null:
upgrade_panel.message.connect(toasts.push)
if shed_panel != null:
shed_panel.message.connect(toasts.push)
build.message.connect(toasts.push)
waves.arrived.connect(func(h: int, at: Vector2) -> void:
toasts.push(arrival_message(enemies.type[enemies.resolve_handle(h)], zones.side_of(at)), Color(1.0, 0.75, 0.55)))
structures.destroyed.connect(func(_id: int, type: String, _at: Vector3) -> void:
toasts.push("Breach! A %s was broken" % StructureSystem.NAMES[type].to_lower(), Color(1.0, 0.35, 0.3)))
animals.pen_changed.connect(func(open: bool) -> void:
if open and campaign.state.phase != CampaignController.Phase.MORNING:
toasts.push("The pen is open: at night the animals in it will get out and roam loose", Color(1.0, 0.55, 0.35)))
scarecrow.patch_denied.connect(func(missing: Dictionary) -> void:
toasts.push("Not enough straw to patch up: need %s more" % ResourceStore.describe(missing), Color(1.0, 0.8, 0.5)))
if alerts != null:
alerts.setup(self)
load_msec = Time.get_ticks_msec() - t0
@ -751,30 +732,10 @@ func _breaker_goals() -> PackedInt32Array:
return out
## "A crow flew in from the east", "A fence breaker came in from the south-west" (side:
## FarmZones.side_of the arrival point).
static func arrival_message(type: int, side: String) -> String:
var from := " from the %s" % side if side != "" else ""
match type:
EnemySystem.TYPE_CROW:
return "A crow flew in" + from
EnemySystem.TYPE_BREAKER:
return "An alien robot came in" + from
EnemySystem.TYPE_UFO:
return "A UFO swept in" + from
return "An alien slipped in" + from
func _on_phase_changed(phase: CampaignController.Phase, _previous: CampaignController.Phase) -> void:
match phase:
CampaignController.Phase.DUSK, CampaignController.Phase.NIGHT:
if toasts != null and scarecrow.alive and not zones.is_inside_fence(player.global_position):
toasts.push("You're outside the fence: get back in before nightfall!" if phase == CampaignController.Phase.DUSK
else "Night has fallen and you're outside the fence!", Color(1.0, 0.55, 0.35))
CampaignController.Phase.DAWN:
behavior.retreat_all(enemies)
if enemies.alive_count() > 0 and toasts != null:
toasts.push("Sunrise! The aliens are running for it", Color(1.0, 0.85, 0.6))
CampaignController.Phase.MORNING:
if partner == null and not replica:
campaign.state.coop = false # a co-op save continued alone: solo rules

View file

@ -39,6 +39,8 @@ extends Node3D
signal gathered(material: String, amount: int, node: GatherNode)
signal deposited(moved: Dictionary)
## What happened, or why not ("Pouch full: ..."). Nothing shows it on screen since #23; tests
## listen to it.
signal message(text: String, color: Color)
## A remote kit pressed interact at the workbench by day (its game opens the upgrade menu).
signal workbench_requested

View file

@ -35,7 +35,7 @@ extends Node3D
## it never shows up mid-night, since a unit only sprouts between mornings.
## Supplies in a carried or dropped sack still count as on the farm (FarmState.supplies_in_transit).
## Claims and carriers are enemy handles (id + generation), so a stale handle from a reused enemy
## slot can never move an item. Every change emits loot_event (toasts now, sounds later); steals,
## slot can never move an item. Every change emits loot_event (sounds, tips); steals,
## recoveries, strays, and supply losses count toward the night's record.
enum Category { CROP, ANIMAL, SUPPLY }

View file

@ -97,9 +97,7 @@ func _ready() -> void:
coop_menu.set_status(text))
lobby.failed.connect(func(text: String) -> void:
if coop_menu.is_open:
coop_menu.set_status(text)
elif sim.toasts != null:
sim.toasts.push(text, Color(1.0, 0.6, 0.4)))
coop_menu.set_status(text))
lobby.lobbies_found.connect(func(list: Array) -> void: coop_menu.show_lobbies(list))
lobby.partner_arrived.connect(_on_partner_arrived)
lobby.joined.connect(_on_joined)
@ -347,10 +345,9 @@ func _on_settings_closed() -> void:
func _set_hud(on: bool) -> void:
for layer_name in ["Hud", "ZoneBanner"]:
var layer := farm.get_node_or_null(layer_name) as CanvasLayer
if layer != null:
layer.visible = on
var layer := farm.get_node_or_null("Hud") as CanvasLayer
if layer != null:
layer.visible = on
func _place_menu_camera() -> void:
@ -366,8 +363,6 @@ func _unhandled_input(event: InputEvent) -> void:
settings.microphone = not settings.microphone
sim.coop.set_microphone(settings.microphone)
settings.save_to(settings_path)
if sim.toasts != null:
sim.toasts.push("Microphone %s" % ("on" if settings.microphone else "muted"), Color(0.85, 0.95, 1.0))
get_viewport().set_input_as_handled()
return
if not event.is_action_pressed("pause"):

View file

@ -1,95 +0,0 @@
class_name ToastFeed
extends VBoxContainer
## Short event messages stacked under the zone banner, each fading after a few seconds. A fixed
## pool of labels is reused (the oldest message gives way). A message that's already showing
## isn't repeated: it counts up instead ("A crow flew in from the east ×4") and stays longer,
## so a flock arriving is one line.
const LIFE := 3.2
const FADE := 0.6
const SLOTS := 5
## Loot events per category (LootSystem.Category): the text ("%s" is the item's noun) and color.
const MESSAGES := {
&"stolen": [["A crop was snatched!", "A %s was grabbed!", "Aliens took %s from the shed!"], Color(1.0, 0.6, 0.15)],
&"dropped": [["The alien dropped the crop. Grab it!", "The alien dropped the %s. Lead it back to the pen!",
"The alien dropped %s. Grab it!"], Color(1.0, 0.9, 0.3)],
&"recovered": [["Crop recovered", "The %s is back in the pen", "%s back in the shed"], Color(0.5, 1.0, 0.45)],
&"returned": [["A dropped crop went back to its plot", "The %s went back to the pen", "%s went back to the shed"],
Color(0.85, 0.95, 1.0)],
&"lost": [["A crop was carried off the farm", "A %s was lost", "%s was carried off the farm"], Color(1.0, 0.3, 0.25)],
&"following": [["", "The %s follows you: lead it back to the pen", ""], Color(0.85, 1.0, 0.7)],
&"follow_full": [["", "You can only lead %d animals at a time", ""], Color(1.0, 0.8, 0.5)],
&"strayed": [["", "A %s wandered out of the open pen!", ""], Color(1.0, 0.6, 0.15)],
}
## Set by FarmSim: what an event's item is.
var loot: LootSystem
var _labels: Array[Label] = []
var _left := PackedFloat32Array()
var _base: Array[String] = [] # each slot's message without its count
var _count := PackedInt32Array()
func _ready() -> void:
set_anchors_preset(Control.PRESET_TOP_WIDE)
offset_top = 152.0
mouse_filter = Control.MOUSE_FILTER_IGNORE
alignment = BoxContainer.ALIGNMENT_BEGIN
_left.resize(SLOTS)
_count.resize(SLOTS)
_base.resize(SLOTS)
for i in SLOTS:
var l := Label.new()
l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
l.add_theme_font_size_override("font_size", 26)
l.add_theme_color_override("font_outline_color", Color.BLACK)
l.add_theme_constant_override("outline_size", 7)
l.visible = false
add_child(l)
_labels.append(l)
func push(text: String, color: Color) -> void:
for i in SLOTS:
if _left[i] > FADE and _base[i] == text:
_count[i] += 1
_labels[i].text = "%s ×%d" % [text, _count[i]]
_left[i] = LIFE
return
var slot := 0
for i in SLOTS:
if _left[i] < _left[slot]:
slot = i
var l := _labels[slot]
_base[slot] = text
_count[slot] = 1
l.text = text
l.add_theme_color_override("font_color", color)
l.visible = true
_left[slot] = LIFE
move_child(l, get_child_count() - 1) # newest at the bottom
func on_loot_event(kind: StringName, id: int, _position: Vector3) -> void:
if not MESSAGES.has(kind):
return
var m: Array = MESSAGES[kind]
var c := int(loot.category[id]) if loot != null else LootSystem.Category.CROP
var text: String = m[0][c]
if text == "":
return
if text.contains("%d"):
text = text % loot.config.max_following_animals
elif text.contains("%s"):
text = text % (loot.noun(id) if loot != null else "item")
push(text[0].to_upper() + text.substr(1), m[1])
func _process(delta: float) -> void:
for i in SLOTS:
if _left[i] <= 0.0:
continue
_left[i] = maxf(_left[i] - delta, 0.0)
_labels[i].visible = _left[i] > 0.0
_labels[i].modulate.a = clampf(_left[i] / FADE, 0.0, 1.0)

View file

@ -1 +0,0 @@
uid://f647f4bijmdy

View file

@ -9,6 +9,8 @@ extends CenterContainer
## Escape / B, interact again, by walking off, or at nightfall. The scarecrow stands still and
## can't shoot while either is open.
## A purchase's result text. Nothing shows it on screen since #23 (the rows say what's missing);
## tests listen to it.
signal message(text: String, color: Color)
signal bought(id: String)

View file

@ -1,37 +0,0 @@
class_name ZoneBanner
extends CanvasLayer
## Shows a zone's name at the top of the screen when the tracked node walks into it, then fades.
@export var zones: FarmZones
@export var target: Node3D
@export var hold_time: float = 1.6
@export var fade_time: float = 0.6
var current: FarmZone
var _label: Label
var _left: float = 0.0
func _ready() -> void:
_label = Label.new()
_label.set_anchors_preset(Control.PRESET_TOP_WIDE)
_label.offset_top = 64.0
_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_label.add_theme_font_size_override("font_size", 36)
_label.add_theme_color_override("font_outline_color", Color.BLACK)
_label.add_theme_constant_override("outline_size", 8)
_label.modulate.a = 0.0
add_child(_label)
func _process(delta: float) -> void:
if zones == null or target == null:
return
var zone := zones.zone_at(target.global_position)
if zone != current:
current = zone
if zone != null:
_label.text = zone.display_name
_left = hold_time + fade_time
_left = maxf(_left - delta, 0.0)
_label.modulate.a = clampf(_left / fade_time, 0.0, 1.0)

View file

@ -1 +0,0 @@
uid://dbfcgsdrh5v60