Skip to content

Instantly share code, notes, and snippets.

@EliteMasterEric
Created May 8, 2015 22:16
Show Gist options
  • Select an option

  • Save EliteMasterEric/a14de1a12a09dfc4fe91 to your computer and use it in GitHub Desktop.

Select an option

Save EliteMasterEric/a14de1a12a09dfc4fe91 to your computer and use it in GitHub Desktop.
Source Memory for Screeps
/* This module allows you to store memory in energy sources,
similarly to other objects like spawns and creeps.
It can even by accessed by the source.memory alias!
To use this in your code, add this line to the top of main:
var SourceMemory = require("SourceMemory");
*/
//Creating source memory...
console.log("Creating source memory...");
//Create memory for energy sources.
if(Memory.sources == undefined)
Memory.sources = { };
Source.prototype.memory = Memory.sources[this.id];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment