Item give command, define panzerium as item

This commit is contained in:
crumblingstatue 2023-04-16 01:16:14 +02:00
parent 4dfb0ff7d7
commit 5f7924b696
5 changed files with 30 additions and 2 deletions

View file

@ -9,6 +9,7 @@ pub enum CmdLine {
Clear,
Tp(Tp),
Spawn,
Give(Give),
}
#[derive(Parser)]
@ -28,6 +29,11 @@ impl Tp {
}
}
#[derive(Parser)]
pub struct Give {
name: String,
}
pub enum Dispatch {
Cmd(Cmd),
ClearConsole,
@ -39,7 +45,7 @@ impl CmdLine {
Ok(Self::try_parse_from(words)?)
}
pub(crate) fn dispatch(&self) -> Dispatch {
pub(crate) fn dispatch(self) -> Dispatch {
match self {
CmdLine::Quit => Dispatch::Cmd(Cmd::QuitApp),
CmdLine::Freecam => Dispatch::Cmd(Cmd::ToggleFreecam),
@ -49,6 +55,7 @@ impl CmdLine {
relative: tp.rel,
}),
CmdLine::Spawn => Dispatch::Cmd(Cmd::TeleportPlayerSpawn),
CmdLine::Give(give) => Dispatch::Cmd(Cmd::GiveItemByName(give.name)),
}
}
}