// getAssetsByClass.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Game.prototype;
/**
* <strong>getAssetsByClass</strong> takes a string representing
* an asset class and tries to return a list of assets.
* @memberOf AdventureJS.Game
* @method AdventureJS.Game#getAssetsByClass
* @param {String} identifier Name or ID of a game object.
* @param {Object} params Used to check for 'prefer_substance' in cases of looking for substances in containers.
* @returns {Object} A game asset.
*/
p.getAssetsByClass = function Game_getAssetsByClass(identifier, params = {}) {
const found = [];
for (let item in this.game.world) {
let asset = this.game.world[item];
if (asset.class && asset.hasClass(identifier)) found.push(asset);
}
return found;
};
})();