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

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

  var p = adventurejs.Tangible.prototype;

  /**
   * <strong>put</strong> places one asset inside another,
   * bypassing onMoveThatToThis and subsequent
   * doMoveThatToThis/doMoveThisToThat.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#put
   * @param {String} preposition
   * @param {Object|String} indirect_object asset object or name/id
   */
  p.put = p.$put = function Game_put(preposition, indirect_object) {
    this.game.log(
      "log",
      "high",
      "put.js > " + this.id + " " + preposition + " " + indirect_object.id,
      "Game"
    );
    if ("string" === typeof indirect_object)
      indirect_object = this.game.getAsset(indirect_object);
    if (
      !preposition ||
      !indirect_object ||
      !indirect_object.aspects[preposition]
    )
      return false;
    this.setPlace(preposition, indirect_object.id);
    return true;
  };
})();