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:
parent
6a9575dfe4
commit
1e91ccf594
18 changed files with 37 additions and 286 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue