// moveThisFromThat.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Assets.Entity.prototype;
/**
* Removes an asset from another asset. It's not meant to be
* called directly, but is the last piece, or bedrock, of the
* removal process after checking for custom logic.
* @memberOf AdventureJS.Assets.Entity
* @method AdventureJS.Assets.Entity#moveThisFromThat
* @param {Object} asset
*/
p.moveThisFromThat = function Entity_moveThisFromThat(asset) {
if ("string" === typeof asset) asset = this.game.getAsset(asset);
if (!asset) return;
this.game.log(
"L1575",
"log",
"high",
`${this.id}.moveThisFromThat(${asset.name})`,
"Entity"
);
for (var aspect in asset.aspects) {
if (asset.aspects[aspect].contents?.includes(this.id)) {
asset.aspects[aspect].contents.splice(
asset.aspects[aspect].contents.indexOf(this.id),
1
);
}
}
return;
};
})();