Adding source code to respository.
This commit is contained in:
33
commands.js
Normal file
33
commands.js
Normal file
@@ -0,0 +1,33 @@
|
||||
module.exports = {
|
||||
configure: function () {
|
||||
// Room management
|
||||
global.RoomInfo = function () { RoomInfo(); };
|
||||
global.RoomAdd = function (name, colonize) { RoomAdd(name, colonize) };
|
||||
global.RoomRemove = function (name) { RoomRemove(name) };
|
||||
}
|
||||
}
|
||||
|
||||
//#region Room management
|
||||
function RoomInfo() {
|
||||
var message = "";
|
||||
Memory.system.rooms.forEach(room => {
|
||||
message += room.name + ": ";
|
||||
message += room.colonize ? "colonize: " : "control: ";
|
||||
var roomObject = Game.rooms[room.name];
|
||||
if (roomObject.controller != undefined) {
|
||||
message += roomObject.controller.my ? "done" : "in progress";
|
||||
}
|
||||
message += "\n";
|
||||
});
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
function RoomAdd(name, colonize) {
|
||||
Memory.system.rooms.push({ name: name, colonize: colonize });
|
||||
}
|
||||
|
||||
function RoomRemove(name) {
|
||||
Memory.system.rooms = Memory.system.rooms.filter((x) => { return x.name != name; })
|
||||
}
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user