Last active
August 29, 2015 14:28
-
-
Save vanhouc/3160ba8d7fa56601c112 to your computer and use it in GitHub Desktop.
RoomPos equality
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
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