Refactor Bot::tick
This commit is contained in:
parent
aa0c03b19a
commit
97ab8897c0
10
src/bot.rs
10
src/bot.rs
@ -86,17 +86,15 @@ impl Bot {
|
||||
}
|
||||
|
||||
pub fn tick(&mut self) -> Result<(), String> {
|
||||
while let Some(event) = self.events.pop_front() {
|
||||
self.handle_event(event)?;
|
||||
}
|
||||
|
||||
let veloren_events = self
|
||||
.client
|
||||
.tick(ControllerInputs::default(), self.clock.dt())
|
||||
.map_err(|error| format!("{error:?}"))?;
|
||||
|
||||
while !self.events.is_empty() {
|
||||
if let Some(event) = self.events.pop_front() {
|
||||
self.handle_event(event)?;
|
||||
}
|
||||
}
|
||||
|
||||
for veloren_event in veloren_events {
|
||||
self.handle_veloren_event(veloren_event)?;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user