Support the built-in command: look

This commit is contained in:
projectmoon 2024-01-17 10:36:04 +01:00
parent 82001b99b7
commit b82b87345e
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
use crate::io::display;
use crate::models::commands::{BuiltinCommand, AiCommand, CommandExecution};
use crate::models::commands::{AiCommand, BuiltinCommand, CommandExecution};
use crate::state::GameState;
use crate::{commands::CommandExecutor, db::Database};
use anyhow::Result;
@ -48,7 +48,12 @@ impl GameLoop {
Ok(())
}
// TODO this will probably eventually be moved to its own file.
async fn handle_builtin(&mut self, builtin: BuiltinCommand) -> Result<()> {
match builtin {
BuiltinCommand::Look => display!("{}", self.state.current_scene),
};
Ok(())
}

View File

@ -12,11 +12,11 @@ pub(crate) fn display_text<S : AsRef<str>>(text: S) {
macro_rules! display {
($text:expr) => {
crate::io::display_text($text);
crate::io::display_text($text)
};
($fmt:expr, $text:expr) => {
crate::io::display_text(format!($fmt, $text));
crate::io::display_text(format!($fmt, $text))
};
}