// addAssetAt.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Assets.Entity.prototype;
/**
* Add specified asset id to the contents of
* specified aspect on this asset.
* Returns contents if aspect exists, or null.
* @memberOf AdventureJS.Assets.Entity
* @method AdventureJS.Assets.Entity#addAssetAt
* @return {Array}
*/
p.addAssetAt = function Entity_addAssetAt(id, aspect) {
this.game.log(
"L1460",
"log",
"medium",
`addAssetAt ${id} ${aspect} ${this.id}`,
"Entity"
);
if (this.hasAspectAt(aspect)) {
if (!this.aspects[aspect].contents.includes(id)) {
this.aspects[aspect].contents.push(id);
}
return this.aspects[aspect].contents;
}
return null;
};
})();