// canContainAssetAt.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Tangible.prototype;
/**
* Check whether this asset can be attached to specified
* other asset.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#canContainAssetAt
* @param {Object} object
* @returns {Boolean}
*/
p.canContainAssetAt = function Tangible_canContainAssetAt(
asset,
preposition
) {
var aspect = this.aspects[preposition];
if (!aspect || !aspect.class) return false;
if (aspect.maxsize > -1 && asset.dimensions.size > aspect.maxsize) {
return false;
}
if (aspect.maxweight > -1 && asset.dimensions.weight > aspect.maxweight) {
return false;
}
if (aspect.maxcount > -1 && aspect.contents.length >= aspect.maxcount) {
return false;
}
return true;
};
})();