mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
GameTick should only happen after Update
This commit is contained in:
parent
833f306e8b
commit
24babbdbe5
3 changed files with 5 additions and 3 deletions
|
@ -869,6 +869,7 @@ async fn run_schedule_loop(
|
||||||
let mut ecs = ecs.lock();
|
let mut ecs = ecs.lock();
|
||||||
|
|
||||||
// if last tick is None or more than 50ms ago, run the GameTick schedule
|
// if last tick is None or more than 50ms ago, run the GameTick schedule
|
||||||
|
ecs.run_schedule(outer_schedule_label);
|
||||||
if last_tick
|
if last_tick
|
||||||
.map(|last_tick| last_tick.elapsed() > Duration::from_millis(50))
|
.map(|last_tick| last_tick.elapsed() > Duration::from_millis(50))
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
|
@ -881,8 +882,6 @@ async fn run_schedule_loop(
|
||||||
ecs.run_schedule(GameTick);
|
ecs.run_schedule(GameTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecs.run_schedule(outer_schedule_label);
|
|
||||||
|
|
||||||
ecs.clear_trackers();
|
ecs.clear_trackers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Disconnect a client from the server.
|
//! Disconnect a client from the server.
|
||||||
|
|
||||||
use azalea_chat::FormattedText;
|
use azalea_chat::FormattedText;
|
||||||
use azalea_entity::LocalEntity;
|
use azalea_entity::{EntityBundle, LocalEntity};
|
||||||
use bevy_app::{App, Plugin, PostUpdate};
|
use bevy_app::{App, Plugin, PostUpdate};
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
component::Component,
|
component::Component,
|
||||||
|
@ -50,6 +50,7 @@ pub fn remove_components_from_disconnected_players(
|
||||||
commands
|
commands
|
||||||
.entity(*entity)
|
.entity(*entity)
|
||||||
.remove::<JoinedClientBundle>()
|
.remove::<JoinedClientBundle>()
|
||||||
|
.remove::<EntityBundle>()
|
||||||
// this makes it close the tcp connection
|
// this makes it close the tcp connection
|
||||||
.remove::<RawConnection>()
|
.remove::<RawConnection>()
|
||||||
// swarm detects when this tx gets dropped to fire SwarmEvent::Disconnect
|
// swarm detects when this tx gets dropped to fire SwarmEvent::Disconnect
|
||||||
|
|
|
@ -4,5 +4,7 @@ use bevy_ecs::schedule::ScheduleLabel;
|
||||||
///
|
///
|
||||||
/// Many client systems run on this schedule, the most important one being
|
/// Many client systems run on this schedule, the most important one being
|
||||||
/// physics.
|
/// physics.
|
||||||
|
///
|
||||||
|
/// This schedule runs either zero or one times after every Bevy `Update`.
|
||||||
#[derive(ScheduleLabel, Hash, Copy, Clone, Debug, Default, Eq, PartialEq)]
|
#[derive(ScheduleLabel, Hash, Copy, Clone, Debug, Default, Eq, PartialEq)]
|
||||||
pub struct GameTick;
|
pub struct GameTick;
|
||||||
|
|
Loading…
Add table
Reference in a new issue