// removeAssetAt.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Assets.Entity.prototype;
/**
* Remove specified asset id from the contents of
* specified aspect on this asset.
* Returns contents if aspect exists, or null.
* @memberOf AdventureJS.Assets.Entity
* @method AdventureJS.Assets.Entity#removeAssetAt
* @return {Array}
*/
p.removeAssetAt = function Entity_removeAssetAt(id, aspect) {
this.game.log(
"L1712",
"log",
"high",
`[Entity.js] ${this.id}.removeAssetAt(${id}, ${aspect})`,
"Entity"
);
aspect = this.getAspectAt(aspect);
if (aspect) {
let index = aspect.contents.indexOf(id);
if (index > -1) {
aspect.contents.splice(index, 1);
}
return aspect.contents;
}
return null;
};
})();