-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
444dcc4
commit ddcbbb5
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::prelude::*; | ||
|
||
/// Controls the items. | ||
#[derive(ConsoleCommand, Parser)] | ||
#[command(name = "item")] | ||
#[command(disable_help_flag = true)] | ||
pub struct ItemCommand { | ||
#[clap(subcommand)] | ||
pub subcommand: ItemCommands, | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum ItemCommands { | ||
/// Lists the available items. | ||
List, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pub mod commands; | ||
pub mod components; | ||
pub mod interfaces; | ||
pub mod plugin; | ||
pub mod registry; | ||
pub mod systems; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::{ | ||
items::commands::*, | ||
prelude::*, | ||
}; | ||
|
||
|
||
/// Applies the item console commands. | ||
pub fn apply_command(mut command: ConsoleCommand<ItemCommand>, item_registry: Res<ItemRegistry>) { | ||
if let Some(Ok(ItemCommand { subcommand })) = command.take() { | ||
match subcommand { | ||
ItemCommands::List => { | ||
for (i, entry) in item_registry.iter().enumerate() { | ||
reply!(command, "{}) {}", i + 1, entry.item.id()); | ||
} | ||
}, | ||
} | ||
reply!(command, ""); | ||
} | ||
} |