station/assets/ui/hud.rsn

180 lines
6.9 KiB
Plaintext
Raw Normal View History

// In-game HUD. Widgets: inventory, skills, log, craft_list, build_list.
root: Column {
width: Fill,
height: Fill,
children: [
// Status and skills.
Panel {
anchor: TopLeft,
offset: (10, 10),
gap: 4,
children: [
Row {
gap: 8,
align: Center,
children: [
Text { text: "{character}", size: 18, color: "accent" },
Text {
text: "[admin]",
size: 13,
color: "good",
visible: "admin",
tooltip: "You are an admin: type /help in the chat for commands",
},
],
},
Text { text: "{server}", size: 13, color: "dim" },
Text { text: "Health {health} / {max_health}", tooltip: "You die at 0. Eat or rest to heal." },
Text { text: "Nutrition {nutrition}%", tooltip: "Drops over time. Eat food to restore it." },
Text { text: "You are hungry!", color: "error", visible: "hungry" },
Text { text: "Position {position}", size: 13, color: "dim" },
Spacer,
Text { text: "Skills", color: "dim" },
Widget("skills"),
],
},
// Inventory and window buttons.
Panel {
anchor: TopRight,
offset: (10, 10),
gap: 6,
children: [
Text { text: "Inventory", color: "dim" },
Widget("inventory"),
Row {
gap: 6,
children: [
Button { text: "Craft", action: "menu:craft", tooltip: "Crafting recipes (C)" },
Button { text: "Build", action: "menu:build", tooltip: "Construct buildings (B)" },
Button { text: "?", action: "menu:help", tooltip: "Controls (H)" },
],
},
],
},
// Message log and chat.
Column {
anchor: BottomLeft,
offset: (10, 10),
gap: 4,
width: Px(620),
children: [
Column {
gap: 1,
padding: 8,
background: "#00000099",
radius: 4,
children: [Widget("log")],
},
Input {
id: "chat",
placeholder: "Say something, or /help for commands",
width: Fill,
max_len: 200,
submit: "chat_send",
visible: "chat_open",
},
Text {
text: "Enter: chat /: command H: help",
size: 12,
color: "dim",
visible: "!chat_open",
},
],
},
Panel {
anchor: Center,
gap: 6,
visible: "craft_open",
children: [
Row {
justify: SpaceBetween,
width: Fill,
align: Center,
children: [
Text { text: "Crafting", size: 20, color: "accent" },
Button { text: "x", action: "menu:close", tooltip: "Close (Esc)" },
],
},
Text { text: "W/S select, Enter craft, or click a recipe", size: 13, color: "dim" },
Column { gap: 4, children: [Widget("craft_list")] },
],
},
Panel {
anchor: Center,
gap: 6,
visible: "build_open",
children: [
Row {
justify: SpaceBetween,
width: Fill,
align: Center,
children: [
Text { text: "Build", size: 20, color: "accent" },
Button { text: "x", action: "menu:close", tooltip: "Close (Esc)" },
],
},
Text { text: "Builds on the highlighted tile in front of you", size: 13, color: "dim" },
Column { gap: 4, children: [Widget("build_list")] },
],
},
Panel {
anchor: Center,
gap: 3,
visible: "help_open",
children: [
Row {
justify: SpaceBetween,
width: Fill,
align: Center,
children: [
Text { text: "Controls", size: 20, color: "accent" },
Button { text: "x", action: "menu:close", tooltip: "Close (Esc)" },
],
},
Text { text: "WASD / arrows move" },
Text { text: "E pick up (own tile, else facing tile)" },
Text { text: "F / left click interact, open machines" },
Text { text: "1-9, 0, wheel select inventory slot" },
Text { text: "U / G use / drop the selected item" },
Text { text: "C / B crafting / build menu" },
Text { text: "X deconstruct the highlighted building" },
Text { text: "Enter, T chat (/ starts a command, /help lists them)" },
Text { text: "Esc close windows, pause menu" },
Text { text: "Hover anything for details.", size: 13, color: "dim" },
],
},
Column {
anchor: Center,
width: Fill,
height: Fill,
align: Center,
justify: Center,
background: "#00000088",
visible: "paused",
children: [
Panel {
gap: 10,
align: Stretch,
width: Px(260),
children: [
Text { text: "Paused", size: 22, color: "accent" },
Text {
text: "The world keeps running.",
size: 13,
color: "dim",
tooltip: "The world is persistent, so it is not paused - your character just stands still.",
},
Button { text: "Resume", action: "resume" },
Button {
text: "Leave world",
action: "leave",
tooltip: "Return to the start menu. Local worlds are saved.",
},
Button { text: "Quit", action: "quit", tooltip: "Local worlds are saved." },
],
},
],
},
],
}