harvest/game/scripts/workbench.gd
Forrest 9f4a1895bd #36: prompts in touch words
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>
2026-10-14 14:30:26 -04:00

47 lines
1.8 KiB
GDScript

class_name Workbench
extends Node3D
## The work area's tool table, where the scarecrow buys upgrades (Upgrades, UpgradePanel): press
## interact here by day to open the menu. Its label shows how many are done.
## #9: not there from the start -- StructureSystem grants it once Night 1 is survived, reusing
## this very node as its view (hidden until then, StructureSystem._add_view toggles it back on;
## see grant_workbench()). It then has HP like any other structure, and can be damaged and
## repaired; at 0 HP it's broken (show_state's broken prompt) until repaired, instead of being
## destroyed.
## How close the scarecrow's center has to be to this node's origin.
@export var reach: float = 2.2
const NORMAL_COLOR := Color(0.85, 0.75, 1.0)
const BROKEN_COLOR := Color(1.0, 0.55, 0.45)
var _label: Label3D
func _ready() -> void:
visible = false # granted, not built -- StructureSystem shows it once that's happened
_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 = NORMAL_COLOR
_label.position = Vector3(0.0, 2.2, 0.0)
_label.visible = false
add_child(_label)
## broken (0 HP): the shop can't be opened until it's repaired.
func show_state(campaign: CampaignController, show: bool, focused: bool, broken: bool = false) -> void:
_label.visible = show
if not show:
return
if broken:
_label.modulate = BROKEN_COLOR
_label.text = "Broken -- repair it" if focused else "Broken"
return
_label.modulate = NORMAL_COLOR
var hint := (Prompts.upgrades() if campaign.is_daytime() else "Upgrades by day") if focused else "Upgrades"
_label.text = "%s\n%d of %d levels" % [hint, Upgrades.levels_bought(campaign.config, campaign.state),
Upgrades.levels_total(campaign.config)]