Skip to content

Commit 7e55c30

Browse files
committed
next debug command
1 parent 141a8eb commit 7e55c30

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/debug_command.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use bevy::input::keyboard::KeyboardInput;
1414
use bevy::input::ButtonState;
1515
use bevy::prelude::*;
1616
use bevy_aseprite_ultra::prelude::Aseprite;
17+
use rand::seq::SliceRandom;
1718

1819
fn process_debug_command(
1920
registry: Registry,
@@ -55,7 +56,16 @@ fn process_debug_command(
5556
}
5657

5758
if local.ends_with("@next") {
58-
in_game_time.set(TimeState::Inactive);
59+
let Some(current) = &level.level else {
60+
return;
61+
};
62+
let props = registry.get_level(&current);
63+
let next = props.next.choose(&mut rand::thread_rng()).unwrap();
64+
level.next_level = next.clone();
65+
level.next_state = Some(PlayerState::from_query(
66+
&player_query.transmute_lens().query(),
67+
));
68+
writer.send(OverlayEvent::Close(GameState::Warp));
5969
local.clear();
6070
} else if local.ends_with("@pause") {
6171
in_game_time.set(TimeState::Inactive);

0 commit comments

Comments
 (0)