cherry-pick Cooperate (#985)
* cooperate pause * fix math * update lastPause before pausing * faster cooperation Co-authored-by: Peli de Halleux <peli@DESKTOP-5B7QRAM.corp.microsoft.com>
This commit is contained in:
committed by
Peli de Halleux
parent
1db61720fc
commit
f0821f8d6c
11
libs/core/cooperate.ts
Normal file
11
libs/core/cooperate.ts
Normal file
@ -0,0 +1,11 @@
|
||||
namespace control {
|
||||
let lastPause = 0;
|
||||
const COOPERATION_INTERVAL = 20
|
||||
export function cooperate() {
|
||||
const now = control.millis()
|
||||
if (now - lastPause > COOPERATION_INTERVAL) {
|
||||
lastPause = now
|
||||
pause(1)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user