fix example
This commit is contained in:
parent
8b976c8e7d
commit
40a4920b12
17
README.md
17
README.md
@ -4,19 +4,22 @@ Roblox Bhop/Surf Bot File Format
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use strafesnet_roblox_bot_file::File;
|
use strafesnet_roblox_bot_file::{File,TimedBlockId};
|
||||||
|
|
||||||
let file=std::fs::File::open("bot_file")?;
|
let file=std::fs::File::open("bot_file")?;
|
||||||
let input=std::io::BufReader::new(file);
|
let input=std::io::BufReader::new(file);
|
||||||
let bot_file=File::new(input)?;
|
let mut bot_file=File::new(input)?;
|
||||||
|
for &TimedBlockId{time,block_id} in &bot_file.header.offline_blocks_timeline{
|
||||||
for &(time,block_id) in &bot_file.header.offline_blocks_timeline{
|
// header is immutably borrowed
|
||||||
let block=bot_file.read_block(block_id)?;
|
// while data is mutably borrowed
|
||||||
|
let block_info=bot_file.header.block_info(block_id)?;
|
||||||
|
let block=bot_file.data.read_block_info(block_info)?;
|
||||||
// offline blocks include the following event types:
|
// offline blocks include the following event types:
|
||||||
// World, Gravity, Run, Camera, Setting
|
// World, Gravity, Run, Camera, Setting
|
||||||
}
|
}
|
||||||
for &(time,block_id) in &bot_file.header.realtime_blocks_timeline{
|
for &TimedBlockId{time,block_id} in &bot_file.header.realtime_blocks_timeline{
|
||||||
let block=bot_file.read_block(block_id)?;
|
let block_info=bot_file.header.block_info(block_id)?;
|
||||||
|
let block=bot_file.data.read_block_info(block_info)?;
|
||||||
// realtime blocks include the following event types:
|
// realtime blocks include the following event types:
|
||||||
// Input, Output, Sound
|
// Input, Output, Sound
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user