Skip to content

Commit

Permalink
Use all redstone sides to enable charger
Browse files Browse the repository at this point in the history
This is a workaround for
<MightyPirates/OpenComputers#3475>.
  • Loading branch information
Hawk777 committed Oct 3, 2021
1 parent fdc7f0e commit 07ad53c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hole-filler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use core::pin::Pin;
use core::time::Duration;
use minicbor::decode::Decoder;
use oc_wasm_futures::sleep;
use oc_wasm_opencomputers::common::{Dimension, Point, RelativeSide, Rgb};
use oc_wasm_opencomputers::common::{Dimension, Point, Rgb};
use oc_wasm_opencomputers::error::Error;
use oc_wasm_opencomputers::{gpu, keyboard, redstone, robot, screen};
use oc_wasm_safe::{component, computer};
Expand Down Expand Up @@ -574,11 +574,15 @@ impl Application {
// If we are low on energy, recharge.
if energy_percent() < 95 {
let mut rs_locked = self.redstone.lock(&mut self.invoker, &mut self.buffer);
rs_locked.set_side_output(RelativeSide::Front, 15).await?;
rs_locked
.set_output(&[Some(15), Some(15), Some(15), Some(15), Some(15), Some(15)])
.await?;
while energy_percent() < 95 {
sleep::for_uptime(Duration::from_secs(10)).await;
}
rs_locked.set_side_output(RelativeSide::Front, 0).await?;
rs_locked
.set_output(&[Some(0), Some(0), Some(0), Some(0), Some(0), Some(0)])
.await?;
}

// Calculate how many layers we can fill on a single trip.
Expand Down

0 comments on commit 07ad53c

Please sign in to comment.