fix R
This commit is contained in:
@@ -52,6 +52,7 @@ impl PlaybackHead{
|
||||
}
|
||||
pub fn seek_to(&mut self,time:SessionTime,new_time:PhysicsTime){
|
||||
self.timer.set_time(time,new_time);
|
||||
self.loop_offset=PhysicsTime::ZERO;
|
||||
// reset head
|
||||
self.head=HEAD_NO_CRASH;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use strafesnet_common::instruction::TimedInstruction;
|
||||
use strafesnet_common::session::Time as SessionTime;
|
||||
use strafesnet_common::physics::Time as PhysicsTime;
|
||||
use strafesnet_roblox_bot_player::{bot::CompleteBot,graphics::Graphics,head::PlaybackHead};
|
||||
|
||||
pub enum SessionControlInstruction{
|
||||
@@ -54,9 +55,7 @@ impl<'a> PlayerWorker<'a>{
|
||||
self.playback_head.set_paused(ins.time,paused);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::Restart)=>{
|
||||
if let Some(bot)=&self.bot{
|
||||
self.playback_head.seek_to(ins.time,bot.time_base());
|
||||
}
|
||||
self.playback_head.seek_to(ins.time,PhysicsTime::ZERO);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipForward)=>{
|
||||
self.playback_head.seek_forward(SessionTime::from_secs(2));
|
||||
|
||||
@@ -71,10 +71,6 @@ impl CompleteBot{
|
||||
})
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn time_base(&self)->f64{
|
||||
self.bot.time_base().get() as f64/PhysicsTime::ONE_SECOND.get() as f64
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn duration(&self)->f64{
|
||||
self.bot.duration().get() as f64/PhysicsTime::ONE_SECOND.get() as f64
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ function speed_ratio(speed) {
|
||||
|
||||
// Controls
|
||||
document.getElementById("control_reset").addEventListener("click", (e) => {
|
||||
playback.seek_to(elapsed(), bot.time_base());
|
||||
playback.seek_to(elapsed(), 0.0);
|
||||
});
|
||||
document.getElementById("control_pause").addEventListener("click", (e) => {
|
||||
paused = !paused;
|
||||
|
||||
Reference in New Issue
Block a user