47 lines
1.1 KiB
Rust
47 lines
1.1 KiB
Rust
/// Commands that the game will ask the runtime to execute.
|
|
|
|
#[derive (PartialEq)]
|
|
pub enum Response {
|
|
/// Print a line of text
|
|
Print (String),
|
|
|
|
/// Print many lines of unformatted text
|
|
PrintMany (Vec <&'static str>),
|
|
|
|
/// Sleep for x milliseconds
|
|
Sleep (u32),
|
|
|
|
/// Quit the game
|
|
Quit,
|
|
|
|
// These are just useful markers for the automated tests
|
|
JokeEnding,
|
|
FailedDetectionCheck,
|
|
PlayerVictory,
|
|
|
|
// These are hints for spam detection on the Telnet frontend
|
|
Nonsense,
|
|
}
|
|
|
|
pub fn print_help () -> Response {
|
|
Response::PrintMany (vec! [
|
|
"All commands are ASCII and case-insensitive.",
|
|
"Commands should start with a verb like LOOK.",
|
|
"e.g. `look table`",
|
|
"Single-word verbs are better, e.g. prefer `hint` over `give me a hint`",
|
|
"When in doubt, try generic verbs like `look` or `use` over specific verbs like `actuate`, `type`, or `consolidate`.",
|
|
])
|
|
}
|
|
|
|
pub fn line_response <S: Into <String>> (line: S) -> Response {
|
|
Response::Print (line.into ())
|
|
}
|
|
|
|
pub fn undetected_item () -> Response {
|
|
line_response ("That ITEM does not exist in this ROOM, or you have not noticed it.")
|
|
}
|
|
|
|
pub fn just <T> (t: T) -> Vec <T> {
|
|
vec! [t]
|
|
}
|