Skip to content

Commit

Permalink
9.5.0! The stability update!
Browse files Browse the repository at this point in the history
Merge the 9.5.0 version into main
  • Loading branch information
InfinityDevTech authored Sep 1, 2023
2 parents d5cc358 + 4af1ff6 commit e98a882
Show file tree
Hide file tree
Showing 37 changed files with 1,305 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ nbproject
*.iws
*.sublime-project
*.sublime-workspace
screeps.toml
#screeps.toml
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"rust-analyzer.linkedProjects": [
"./Cargo.toml"
]
"rust-analyzer.showUnlinkedFileNotification": false
}
45 changes: 45 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ web-sys = { version = "0.3", features = ["console"] }
structstruck = "0.4.1"
serde_json = "1.0.104"
serde = { version = "1.0.183", features = ["derive"] }
regex = "1.9.4"

[dev-dependencies]
wasm-bindgen-test = "0.3"
Expand All @@ -30,14 +31,15 @@ lto = true
# Replace the following to enable wasm-opt optimization
# wasm-pack will try to install wasm-opt automatically, but it must be installed by hand on some
# operating systems.
wasm-opt = false
#wasm-opt = false
# See wasm-opt for full available options; handy examples:
# -O4 - optimize aggressively for performance
# -Oz - optimize aggressively for code size
# -g - leave debug info in place, allowing for more descriptive stack traces on panic
# --disable-sign-ext - prevents opcodes that the screeps servers can't load (see
# --disable-sign-ext - prevents opcodes that the screeps servers can't load (see
# https://github.com/rustyscreeps/screeps-game-api/issues/391)
#wasm-opt = ["-O4", "--disable-sign-ext"]
wasm-opt = ["-O4", "--disable-sign-ext"]
#wasm-opt = ["-g", "--disable-sign-ext"]

[features]
default = []
Expand Down
27 changes: 24 additions & 3 deletions javascript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
let wasm_module;

// replace this with the name of your module
const MODULE_NAME = "screeps";
const MODULE_NAME = "crustacean";
let EXECUTION_PAUSED = false;
let RED_BUTTON = false;
let WIPE_MEMORY = false;

function console_error(...args) {
console.log(...args);
Expand All @@ -29,11 +30,24 @@ global.big_red_button = function (input) {
}
};

global.wipe_memory = function () {
EXECUTION_PAUSED = true;
WIPE_MEMORY = true;
console.log("Wiping memory");
}

global.toggle_exec = function () {
EXECUTION_PAUSED = !EXECUTION_PAUSED
return `Successfully toggled execution pause to: ${EXECUTION_PAUSED}`
}

global.suicide_all = function() {
for (let creep in Game.creeps) {
let c = Game.creeps[creep];
c.suicide()
}
}

module.exports.loop = function () {
// Replace the Memory object (which gets populated into our global each tick) with an empty
// object, so that accesses to it from within the driver that we can't prevent (such as
Expand All @@ -48,11 +62,18 @@ module.exports.loop = function () {
global.Memory = {};
try {
if (wasm_module) {
if (!EXECUTION_PAUSED) {
wasm_module.loop();
}
if (RED_BUTTON) {
wasm_module.red_button();
RED_BUTTON = false;
EXECUTION_PAUSED = false;
}
if (!EXECUTION_PAUSED) {
wasm_module.loop();
if (WIPE_MEMORY) {
wasm_module.wipe_memory();
WIPE_MEMORY = false;
EXECUTION_PAUSED = false;
}
} else {
// attempt to load the wasm only if there's enough bucket to do a bunch of work this tick
Expand Down
34 changes: 34 additions & 0 deletions screeps.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
default_deploy_mode = "upload"

[build]
# options to allow building code against rust versions >=1.70 without opcodes
# incompatible with screeps server environments; requires nightly rust. See
# https://github.com/rustyscreeps/screeps-game-api/issues/391
extra_options = ["--config", "build.rustflags=['-Ctarget-cpu=mvp']", "-Z", "build-std=std,panic_abort", "-Z", "build-std-features=panic_immediate_abort"]

[upload]
auth_token = "fbfeb887-6c37-4ef9-922f-01eea5b927f0"
[upload.build]
build-target="release"

[ptr]
auth_token = "your screeps.com auth token"
prefix = "ptr"

[copy]
#destination = "/home/jwjoh/.config/Screeps/scripts/vps_bezoka_pl___21025"
#destination = "/home/jwjoh/.config/Screeps/scripts/127_0_0_1___21025"
destination = "/home/jwjoh/.config/Screeps/scripts/super_directconnect_wyatt_world___21025"
[copy.build]
# set the sim feature to allow for use with the coordinates in the simulation room
extra_options = ["--features=sim", "--config", "build.rustflags=['-Ctarget-cpu=mvp']", "-Z", "build-std=std,panic_abort", "-Z", "build-std-features=panic_immediate_abort", "--debug"]
build-target = "release"

[season]
auth_token = "your screeps.com auth token"
prefix = "season"
[season.build]
extra_options = ["--features=my-crate-season-1-feature", "--config", "build.rustflags=['-Ctarget-cpu=mvp']", "-Z", "build-std=std,panic_abort", "-Z", "build-std-features=panic_immediate_abort"]

# for full syntax and available options, see
# https://github.com/rustyscreeps/screeps-game-api/blob/master/screeps-defaults.toml
Loading

0 comments on commit e98a882

Please sign in to comment.