safeguard commands

This commit is contained in:
AviiNL
2023-12-23 08:53:46 +01:00
parent 8851594537
commit 05f4859f67
14 changed files with 749 additions and 282 deletions

View File

@@ -27,17 +27,9 @@ pub struct CommandsPlugin;
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
/// The SystemSet for console/command related systems
pub enum ConsoleSet {
/// Systems operating the console UI (the input layer)
ConsoleIO,
/// Systems executing console commands (the functionality layer).
/// All command handler systems are added to this set
Commands,
/// Systems running after command systems, which depend on the fact commands have executed beforehand (the output layer).
/// For example a system which makes use of [`PrintConsoleLine`] events should be placed in this set to be able to receive
/// New lines to print in the same frame
PostCommands,
}
/// Run condition which does not run any command systems if no command was entered
@@ -49,14 +41,6 @@ impl Plugin for CommandsPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<ConsoleConfiguration>()
.add_event::<ConsoleCommandEntered>()
.configure_sets(
Update,
(
ConsoleSet::Commands
.after(ConsoleSet::ConsoleIO)
.run_if(have_commands),
ConsoleSet::PostCommands.after(ConsoleSet::Commands),
),
);
.configure_sets(Update, ConsoleSet::Commands.run_if(have_commands));
}
}