Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// createGlobalWalls.js

(function () {
  /*global adventurejs A*/
  "use strict";

  var p = adventurejs.Game.prototype;

  /**
   * Create global walls.
   * @memberOf adventurejs.Game
   * @method adventurejs.Game#createGlobalWalls
   * @kind function
   */
  p.createGlobalWalls = function Game_createGlobalWalls() {
    //console.warn( "globalWalls", this.globalWalls );
    for (var i = 0; i < A.GlobalAssets.Walls.length; i++) {
      var wall = A.GlobalAssets.Walls[i];

      var description;
      if (wall.descriptions && wall.descriptions.look) {
        description = wall.descriptions.look;
      } else if (wall.description) {
        description = wall.description;
      } else {
        description = "";
      }

      this.world["global_" + wall.direction + "_wall"] = new adventurejs.Wall(
        wall.direction + " wall",
        this.game_name
      );
      this.world["global_" + wall.direction + "_wall"].set({
        is: {
          global: true,
          known: true,
          seen: true,
        },
        name: wall.direction + " wall",
        direction: wall.direction,
        class: "Wall",
        id: "global_" + wall.direction + "_wall",

        singlePluralPairs: [["wall", "walls"]],
        adjectives: [wall.direction],
      });
      this.world["global_" + wall.direction + "_wall"].descriptions.look =
        description;
      this.world["global_" + wall.direction + "_wall"].enabled = wall.enabled;
    }
  };
})();