Reputation: 465
There is a Game.cpu.halt()
function. Is there a Game.cpu.yield()
function I can call to suspend execution until the next tick?
It sure would make my webassembly life A LOT
easier.
Upvotes: 1
Views: 153
Reputation: 644
If you want to do so to save your CPU that happens all the time. All CPU time left fills a CPU buffer called bucket. The bucket has only a certain capacity and can only be partially accessed, but it allows to save a lot of CPU time for later use.
If you want to stop your current execute you could use: the method Game.cpu.halt() as described in the API.
https://docs.screeps.com/api/#Game.cpu.halt
Upvotes: 3