Skip to content

Instantly share code, notes, and snippets.

@vanhouc
Last active August 29, 2015 14:28
Show Gist options
  • Save vanhouc/3160ba8d7fa56601c112 to your computer and use it in GitHub Desktop.
Save vanhouc/3160ba8d7fa56601c112 to your computer and use it in GitHub Desktop.
RoomPos equality
saveRoomPos(target) {
var pos = target.pos ? target.pos : target
if (!Memory.positions) Memory.positions = [];
Memory.positions.push({x: pos.x, y: pos.y, roomName: pos.roomName});
}
isInMemory(target) {
if (!Memory.positions) return false;
return _.find(Memory.positions, function(pos) new RoomPosition(pos.x, pos.y, pos.roomName).isEqualTo(target)) != null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment