Refactor Bot::tick

This commit is contained in:
Jeff 2024-06-14 19:18:11 -04:00
parent aa0c03b19a
commit 97ab8897c0

View File

@ -86,17 +86,15 @@ impl Bot {
} }
pub fn tick(&mut self) -> Result<(), String> { pub fn tick(&mut self) -> Result<(), String> {
while let Some(event) = self.events.pop_front() {
self.handle_event(event)?;
}
let veloren_events = self let veloren_events = self
.client .client
.tick(ControllerInputs::default(), self.clock.dt()) .tick(ControllerInputs::default(), self.clock.dt())
.map_err(|error| format!("{error:?}"))?; .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 { for veloren_event in veloren_events {
self.handle_veloren_event(veloren_event)?; self.handle_veloren_event(veloren_event)?;
} }