Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing halt command to CPU #141

Merged
merged 1 commit into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,14 @@ interface CPU {
* ArrayBuffer instances over a certain size are externally allocated and will be counted here.
*/
getHeapStatistics?(): HeapStatistics;

/**
* This method will be undefined if you are not using IVM.
*
* Reset your runtime environment and wipe all data in heap memory.
* Player code execution stops immediately.
*/
halt?(): never;
}

interface HeapStatistics {
Expand Down
7 changes: 7 additions & 0 deletions dist/screeps-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ function resources(o: GenericStore): ResourceConstant[] {
Game.cpu.setShardLimits({ shard0: 20, shard1: 10 });
}

// Game.cpu.halt()
{
if (Game.cpu.hasOwnProperty("halt")) {
Game.cpu.halt!();
}
}

// Game.getObjectById(id)

{
Expand Down
8 changes: 8 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ interface CPU {
* ArrayBuffer instances over a certain size are externally allocated and will be counted here.
*/
getHeapStatistics?(): HeapStatistics;

/**
* This method will be undefined if you are not using IVM.
*
* Reset your runtime environment and wipe all data in heap memory.
* Player code execution stops immediately.
*/
halt?(): never;
}

interface HeapStatistics {
Expand Down