// setPlace.js
(function () {
/* global adventurejs A */
var p = adventurejs.Tangible.prototype;
/**
* Set an asset's place, aka parent asset and aspect.
* This is how one thing is put inside another.
* cap.setPlace( 'attached', 'pen' );
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#setPlace
* @param {String} aspect
* @param {String} asset_id
* @return {Object}
*/
p.setPlace = function Tangible_setPlace(aspect, asset_id) {
let asset;
if (asset_id?.id) {
asset = asset_id;
asset_id = asset.id;
}
if (asset_id && !asset) asset = this.game.getAsset(asset_id);
if (asset && !aspect) {
aspect = asset.default_aspect;
}
if (asset && aspect) {
this.place = { [aspect]: asset_id };
} else this.place = {};
return this.place;
};
})();