overhauled turtle client
This commit is contained in:
parent
25322aab0e
commit
5e9a99e030
2 changed files with 59 additions and 51 deletions
|
|
@ -200,7 +200,7 @@ async fn cancel(
|
|||
}
|
||||
|
||||
async fn update_turtles(State(state): State<SharedControl>) -> &'static str {
|
||||
for turtle in state .write().await.turtles.iter_mut() {
|
||||
for turtle in state.read().await.turtles.iter() {
|
||||
turtle.write().await.pending_update = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ pub(crate) async fn process_turtle_update(
|
|||
) -> anyhow::Result<TurtleCommand> {
|
||||
let mut turtle = state
|
||||
.turtles
|
||||
.get_mut(id as usize)
|
||||
.get(id as usize)
|
||||
.context("nonexisting turtle")?.write().await;
|
||||
let world = &mut state.world;
|
||||
|
||||
|
|
@ -329,13 +329,15 @@ pub(crate) enum TurtleCommand {
|
|||
DropFront(u32),
|
||||
DropUp(u32),
|
||||
DropDown(u32),
|
||||
SuckFront(u32),
|
||||
SuckUp(u32),
|
||||
SuckDown(u32),
|
||||
Select(u32),
|
||||
/// Slot in inventory
|
||||
ItemInfo(u32),
|
||||
Update,
|
||||
Poweroff,
|
||||
Refuel,
|
||||
Dump,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue