changed git root
This commit is contained in:
47
default/main.js
Normal file
47
default/main.js
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
/* ######################
|
||||
# Screeps 2022 #
|
||||
######################*/
|
||||
|
||||
const system = require("system");
|
||||
|
||||
module.exports.loop = function () {
|
||||
if (global.compiled == undefined) {
|
||||
// Configure classes and constants
|
||||
setupClasses();
|
||||
setConstants();
|
||||
console.log("Script recompiled...");
|
||||
global.compiled = true;
|
||||
} else {
|
||||
if (global.started == undefined) {
|
||||
// After one tick of configuration, restart the system.
|
||||
system.start();
|
||||
console.log("System started...");
|
||||
global.started = true;
|
||||
}
|
||||
system.update();
|
||||
}
|
||||
}
|
||||
|
||||
const creepClass = require("ClassCreep");
|
||||
const roomClass = require("ClassRoom");
|
||||
const spawnClass = require("ClassSpawn");
|
||||
|
||||
// Overwrite all game defined classes by inherited ones.
|
||||
function setupClasses() {
|
||||
creepClass.setup();
|
||||
roomClass.setup();
|
||||
spawnClass.setup();
|
||||
}
|
||||
|
||||
// Adds additional constants to global scope
|
||||
function setConstants() {
|
||||
// The states of a room.
|
||||
global.ROOMSTATE_NEUTRAL = 0;
|
||||
global.ROOMSTATE_CAPITAL = 1;
|
||||
global.ROOMSTATE_COLONY = 2;
|
||||
global.ROOMSTATE_OUTPOST = 3;
|
||||
|
||||
// The roles of creeps.
|
||||
global.ROLE_HARVESTER = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user