use Time.into()

This commit is contained in:
2026-02-26 08:59:25 -08:00
parent 7a421d1eab
commit 81a158d08f
5 changed files with 12 additions and 15 deletions

View File

@@ -3,8 +3,6 @@ use wasm_bindgen::JsValue;
use strafesnet_roblox_bot_file::v0;
use strafesnet_roblox_bot_player::{bot,head,time,graphics};
use strafesnet_graphics::setup;
use strafesnet_common::physics::Time as PhysicsTime;
use strafesnet_common::run::Time as RunTime;
// Hack to keep the code compiling,
// SurfaceTarget::Canvas is not available in IDE for whatever reason.
@@ -73,12 +71,12 @@ impl CompleteBot{
}
#[wasm_bindgen]
pub fn duration(&self)->f64{
self.bot.duration().get() as f64/PhysicsTime::ONE_SECOND.get() as f64
self.bot.duration().into()
}
#[wasm_bindgen]
pub fn run_duration(&self,mode_id:u32)->Option<f64>{
let mode=v0::ModeID(mode_id);
Some(self.bot.run_duration(mode)?.get() as f64/RunTime::ONE_SECOND.get() as f64)
Some(self.bot.run_duration(mode)?.into())
}
}
@@ -132,7 +130,7 @@ impl PlaybackHead{
pub fn get_head_time(&self,time:f64)->f64{
let time=time::from_float(time).unwrap();
let time=self.head.time(time);
time.get() as f64/PhysicsTime::ONE_SECOND.get() as f64
time.into()
}
/// Set the playback head position to new_time.
#[wasm_bindgen]
@@ -147,7 +145,7 @@ impl PlaybackHead{
let time=bot.bot.time(self.head.time(time));
let mode=v0::ModeID(mode_id);
let run_time=self.head.state().get_run(mode)?.time(time);
Some(run_time.get() as f64/RunTime::ONE_SECOND.get() as f64)
Some(run_time.into())
}
#[wasm_bindgen]
pub fn is_run_in_progress(&self,mode_id:u32)->Option<bool>{