This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blindEntrance: function(creep, roomName) { | |
if ((creep.memory.targets.lastRoom == undefined || creep.memory.targets.lastRoom != creep.room.name) && creep.fatigue == 0) { | |
creep.memory.targets.position = undefined; | |
} | |
if (creep.memory.targets.position == undefined) { | |
if (Game.map.isRoomProtected(roomName)) { | |
this.log(creep.room.name, creep.name + " is trying to move to protected room " + roomName); | |
return; | |
} | |
var exit = creep.room.findExitTo(roomName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findNearestStorage: function(creep) { | |
var pref = undefined; | |
if (creep.room.storage != undefined) | |
pref = creep.room.storage; | |
for (var link in creep.room.memory.energy.linkSources) { | |
var l = Game.getObjectById(link); | |
if (l != null && creep.pos.getRangeTo(pref) > creep.pos.getRangeTo(l)) | |
pref = l; | |
} | |
if (pref == undefined || pref == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findNearestStorage: function(creep) { | |
var pref = undefined; | |
if (creep.room.storage != undefined) | |
pref = creep.room.storage; | |
for (var link in creep.room.memory.energy.linkSources) { | |
var l = Game.getObjectById(link); | |
if (l != null && creep.pos.getRangeTo(pref) > creep.pos.getRangeTo(l)) | |
pref = l; | |
} | |
if (pref == undefined || pref == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = function(creep) { | |
let store = Game.getObjectById(creep.memory.store); | |
let spawn = Game.spawns.Spawn1; | |
let miner = Game.creeps[creep.memory.miner]; | |
///////////////////////need some way to set the miner here and get its name or id in creep.memory.miner | |
if (miner == undefined) { | |
if (!Memory.transporters || Memory.transporters >= Memory.bots.miner.length){ | |
Memory.transporters = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
module.exports = function(creep) { | |
if (creep.memory.state == undefined || creep.carry.energy == 0) { | |
creep.memory.state = "pickup"; | |
} else if (creep.carry.energy == creep.carryCapacity) { | |
creep.memory.state = "work"; | |
} | |
if (creep.memory.state == "pickup") { | |
let storage = creep.room.storage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var hooks = require('hooks'); | |
var autospawn = require("autospawn"); | |
var minerFunc = require("miner"); | |
var transporterFunc = require("transporter"); | |
var builderFunc = require('builder'); | |
var upgraderFunc = require('upgrader'); | |
var janitorFunc = require('janitor'); | |
var repairerFunc = require("repairer"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deserialize: function(str) { | |
//var timer = Game.getUsedCpu(); | |
if (str == null) | |
str = "02161101101010100121222222222222222222222222222222222222222222"; | |
var path = []; | |
for (var i = 0; i < (str.length - 4) / 2; ++i) { | |
path.push({x: 0, y: 0, dx: 0, dy: 0, direction: 0}); | |
} | |
var pos = [0, 0]; | |
var loc = 0; |