Prompts (game/scripts/prompts.gd) holds every key-naming prompt: on a phone (MobilePort.active()) it says each in touch words, elsewhere exactly the old string. World labels drop the key (Gather, Repair, Upgrade to, Upgrades, Shop), the build ghost says Place / Dismantle, the build bar's line is "Place · Rotate · Dismantle · Done" and its slots drop the number keys, the cutscenes say "Hold to skip" / "Tap to skip", the tip footer says "× hides tips", and the tutorial's tips and the first morning's sign name the thumbs (sides from TouchSticks), Use, Build, Place, Fear, Bomb, Patch, the hotbar, and the backpack. MobilePort gains the `forced` test override. game/tests/mobile/prompts_test.gd checks every phone string and that the desktop strings are byte for byte as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
134 lines
6.5 KiB
GDScript
134 lines
6.5 KiB
GDScript
class_name Prompts
|
||
extends RefCounted
|
||
## The game's prompts that name a key, a mouse button, or a gamepad button, in one place. On a
|
||
## phone (MobilePort.active()) each says it in touch words instead: the controls there are the
|
||
## two thumbsticks (TouchSticks) and the touch buttons (Use, Build, Fear, Bomb, Patch, Pause; in
|
||
## build mode Place, Rotate, Dismantle, Done), the hotbar, the backpack, and the tip box's ×.
|
||
## Everywhere else each returns exactly the string the game showed before. Phones change a
|
||
## prompt's words, never how many there are.
|
||
## * World labels: gather, repair, upgrade (Interactions), the workbench and the shed counter.
|
||
## * Build mode: the ghost's label (BuildMode) and the build bar (BuildHud).
|
||
## * Cutscenes: the skip hints (OpeningIntro, FarmersReturn).
|
||
## * The tutorial: each tip (Tutorial.TEXT; on phones TOUCH_TIPS) and the tip box's footer.
|
||
## * The first morning's sign (ReviewPanel): how the day and the night are played.
|
||
|
||
## The tutorial's tips that name a control, in touch words (the others read the same on phones:
|
||
## Tutorial.TEXT). {move} and {attack} are the screen sides of the move and attack sticks.
|
||
const TOUCH_TIPS := {
|
||
"move": "Move with your {move} thumb: touch the {move} half of the screen and slide. You're the scarecrow: keep the farm safe until the farmers are back.",
|
||
"gather": "Hold Use at a dead tree, the haystacks, or the scrap heap to gather wood, straw, and scrap.",
|
||
"store": "Your pouch only holds so much (tap the backpack to see what's in it): walk onto the barn's apron (the Supply Shed) to store what you carry.",
|
||
"build": "Build (by day): tap Build, pick a fence, put your {attack} thumb where it goes, then tap Place. Aliens have to break through fences.",
|
||
"shoot": "Your {attack} thumb aims and attacks: slide it toward an alien to stab with your pitchfork. The supply shed sells a corn shooter (tap the hotbar to switch); more weapons arrive there over the days, like pumpkin bombs for your off-hand (Bomb throws one).",
|
||
"fear": "Crowded? Tap Fear to scare off everything nearby, and they drop what they carry.",
|
||
"patch": "Hurt? Hold Patch to patch up with straw. Health carries over to the next night.",
|
||
}
|
||
|
||
|
||
## Touch wording (a phone, or `-- --mobile`).
|
||
static func touch() -> bool:
|
||
return MobilePort.active()
|
||
|
||
|
||
## The screen half the move stick is on: "right" or "left".
|
||
## #38 points this at TouchSticks' move_on_right variable (which #41's Swap setting flips).
|
||
static func move_side() -> String:
|
||
return "right" if TouchSticks.MOVE_ON_RIGHT else "left"
|
||
|
||
|
||
## The screen half the attack stick is on: the other one.
|
||
static func attack_side() -> String:
|
||
return "left" if move_side() == "right" else "right"
|
||
|
||
|
||
# --- World labels (Label3D; ScreenLabels draws them flat on phones) ---
|
||
|
||
## A gather point in reach (Interactions).
|
||
static func gather() -> String:
|
||
return "Gather" if touch() else "[E / X] Gather"
|
||
|
||
|
||
## A damaged structure in reach (Interactions); cost as ResourceStore.describe gives it.
|
||
static func repair(cost: String) -> String:
|
||
return ("Repair (%s)" if touch() else "[E / X] Repair (%s)") % cost
|
||
|
||
|
||
## A levelable structure in reach (Interactions): the level it would go to and what that costs.
|
||
static func upgrade_to(level: int, cost: String) -> String:
|
||
return ("Upgrade to L%d (%s)" if touch() else "[E / X] Upgrade to L%d (%s)") % [level, cost]
|
||
|
||
|
||
## The workbench, in reach by day (Workbench).
|
||
static func upgrades() -> String:
|
||
return "Upgrades" if touch() else "[E / X] Upgrades"
|
||
|
||
|
||
## The shed counter, in reach by day (ShedCounter).
|
||
static func shop() -> String:
|
||
return "Shop" if touch() else "[E / X] Shop"
|
||
|
||
|
||
# --- Build mode ---
|
||
|
||
## The ghost's label when it can go down here (BuildMode).
|
||
static func build_place() -> String:
|
||
return "Place" if touch() else "[LMB / RT] Build"
|
||
|
||
|
||
## The ghost's label over a built structure (BuildMode); the refund follows it.
|
||
static func dismantle() -> String:
|
||
return "Dismantle" if touch() else "[RMB / B] Dismantle"
|
||
|
||
|
||
## The build bar's controls line (BuildHud).
|
||
static func build_help() -> String:
|
||
return "Place · Rotate · Dismantle · Done" if touch() \
|
||
else "LMB / RT build · Z C / d-pad rotate · 1-4 / Tab pick · RMB / B dismantle or leave"
|
||
|
||
|
||
## A build bar slot's heading: its number key and the structure's name (BuildHud). Phones pick by
|
||
## tapping the slot, so there it's the name alone.
|
||
static func build_slot(number: int, structure: String) -> String:
|
||
return structure if touch() else "%d %s" % [number, structure]
|
||
|
||
|
||
# --- Cutscenes ---
|
||
|
||
## The opening intro's skip hint (OpeningIntro): a long press anywhere skips it on phones.
|
||
static func intro_skip() -> String:
|
||
return "Hold to skip" if touch() else "Hold [Space / Enter / A] to skip"
|
||
|
||
|
||
## The farmers' return's skip hint (FarmersReturn): a tap skips it on phones.
|
||
static func return_skip() -> String:
|
||
return "Tap to skip" if touch() else "[Space / Enter / A] skip"
|
||
|
||
|
||
# --- The tutorial ---
|
||
|
||
## A tip's text (Tutorial): on phones its TOUCH_TIPS wording, if it has one.
|
||
static func tip(id: String) -> String:
|
||
if touch() and TOUCH_TIPS.has(id):
|
||
return (TOUCH_TIPS[id] as String).format({"move": move_side(), "attack": attack_side()})
|
||
return Tutorial.TEXT[id]
|
||
|
||
|
||
## The line under each tip (Tutorial): how to hide them.
|
||
static func tip_footer() -> String:
|
||
return "Tip · × hides tips" if touch() else "Tip · [Backspace / Back] hide tips"
|
||
|
||
|
||
# --- The first morning's sign (ReviewPanel) ---
|
||
|
||
## The day's paragraph.
|
||
static func sign_day() -> String:
|
||
if touch():
|
||
return "By day, gather wood, scrap, and straw (hold Use), store them at the barn, and build defenses (tap Build). There's more to gather off the farm, to the north, east, and south."
|
||
return "By day, gather wood, scrap, and straw (hold E), store them at the barn, and build defenses (B). There's more to gather off the farm, to the north, east, and south."
|
||
|
||
|
||
## The night's paragraph.
|
||
static func sign_night() -> String:
|
||
if touch():
|
||
return ("At night, stab aliens with your pitchfork (%s thumb), scare them off (Fear), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons on the hotbar), and more weapons arrive there over the days." % attack_side())
|
||
return "At night, stab aliens with your pitchfork (left mouse), scare them off (Q), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons with Tab or the number keys), and more weapons arrive there over the days."
|