Pre-release
AdventureJS Docs Downloads Bundler Devlog
Score: 0 Moves: 0
// resetWorld.js

/* global AdventureJS A */

/**
 * Reset the world to the baseline snapshot.
 * @method AdventureJS#resetWorld
 * @memberOf AdventureJS
 */
AdventureJS.FX.resetWorld = function AdventureJS_resetWorld() {
  this.game.log(
    "L1727",
    "log",
    "high",
    "resetWorld.js attempting to reset the world.",
    "CopyOperations"
  );
  var starttime = new Date().getTime();

  // delete the current world
  this.world = {};

  // restore entire world from baseline
  this.world = A.FX.clone.call(this, this.baseline.world);

  this.game.scorecard.restoreScore();

  this.game.log(
    "L1728",
    "log",
    "high",
    "resetWorld() took " +
      (new Date().getTime() - starttime) / 1000 +
      " seconds.",
    "CopyOperations"
  );

  return true;
};