// getExitFromDirection.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Game.prototype;
/**
* Does current room have an exit in that direction?
* If not use global exit.
* Always applies to currentRoom.
* If no exit found, returns false.
* @method adventurejs.Game#getExitFromDirection
* @memberOf adventurejs.Game
* @param {String} direction
* @returns {Object} An exit.
*/
p.getExitFromDirection = function Game_getExitFromDirection(direction) {
var exit = false;
if (
"undefined" !==
typeof this.game.world[this.game.world._currentRoom + "_" + direction]
) {
exit = this.game.world[this.game.world._currentRoom + "_" + direction];
} else if ("undefined" !== typeof this.game.world["global_" + direction]) {
exit = this.game.world["global_" + direction];
}
return exit;
};
})();