Skip to content

Instantly share code, notes, and snippets.

script.on_init(function()
firstrun = true
end)
script.on_event(defines.events.on_tick, function(event)
if(firstrun) then
firstrun = false
autocapture(1)
end
end)
@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) {
module.exports = function(config) {
if(config.cli){
/** Current Way:
let onPlayerSandbox = config.engine.onPlayerSandbox;
config.engine.onPlayerSandbox = function(sandbox, userId) {
sandbox.test = function(){ return 'Hello World!' }
return onPlayerSandbox(sandbox,userId)
}
**/
// Proposed way
/*
Scramble/descramble raw NAND dumps from the NES Classic.
plutoo 2016
Cheers to brizzo, derrek.
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
@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});

Keybase proof

I hereby claim:

  • I am ags131 on github.
  • I am ags131 (https://keybase.io/ags131) on keybase.
  • I have a public key whose fingerprint is 7FB0 1C83 7090 5C3D 82FC 15AC EBFE 6638 3E51 64DB

To claim this, I am signing this object:

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdint>
#include <memory>
#include <map>
#include <list>
#include <vector>
#include <set>
#include <algorithm>
#include "crypto.h"
@AlinaNova21
AlinaNova21 / apitoken.js
Created October 27, 2016 21:14
apitoken mod for screeps server
// Add a new function to player sandbox space
// Some Super Secret Secret (32 character hex string)
const secret = Buffer.from('DEADBEEF000000000000000000000000', 'hex')
const jwt = require('./lib/jwt')
module.exports = function (config) {
if (config.engine) {
config.engine.onPlayerSandbox = function (sandbox) {
sandbox.getAPIToken = function () {
let key = generateToken(sandbox.module.user)
@AlinaNova21
AlinaNova21 / RoomVisual.js
Last active June 16, 2017 15:43
RoomVisual structure rendering
/*********************************************/
/********** Moved to Screepers repo **********/
/** https://github.com/screepers/RoomVisual **/
/*********************************************/
const colors = {
gray: '#555555',
light: '#AAAAAA',
road: '#666', // >:D
energy: '#FFE87B',