Skip to content

Instantly share code, notes, and snippets.

View sparr's full-sized avatar

Clarence "Sparr" Risher sparr

  • Kira Learning
  • New York / San Francisco
View GitHub Profile
@AlinaNova21
AlinaNova21 / findAttack.js
Created September 14, 2016 04:45
Screeps Invader Source Code
var flee = require('flee');
function checkPath(pos1, pos2) {
var path = pos1.findPathTo(pos2);
if (!path.length) {
return false;
}
return path[path.length - 1].x == pos2.x && path[path.length - 1].y == pos2.y;
}
function costCallbackIgnoreRamparts(roomName, cm) {
var ramparts = Game.rooms[roomName].find(FIND_STRUCTURES, {filter: i => i.structureType == STRUCTURE_RAMPART || i.structureType == STRUCTURE_WALL});
@AlinaNova21
AlinaNova21 / main.js
Created September 14, 2016 04:53
Screeps Source Keeper Source
PathFinder.use(true);
for (var i in Game.creeps) {
var creep = Game.creeps[i], source = undefined;
if (!creep.room) {
continue;
}
if (creep.memory.sourceId) {
source = Game.getObjectById(creep.memory.sourceId);
}
if(!source) {