// updateRoomImageWidgets.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Display.prototype;
/**
* Set Room image if there is one.
* @method AdventureJS.Display#updateRoomImageWidgets
* @param {String} image The id of an image in game.image_lookup.
* @returns {AdventureJS.Display} Returns the instance the method is called on (useful for chaining calls.)
* @chainable
*/
p.updateRoomImageWidgets = function Display_updateRoomImageWidgets(image) {
const room = this.game.getAsset(this.game.world._room);
if ("undefined" === typeof image) {
image = room.image;
}
if (!image) return this;
this.room_image_widgets.forEach(function (widget) {
const src = this.game.getImage(image);
if (src) {
widget.innerHTML = `<span class="ajs-image-container ajs-room-image">${src}</span>`;
} else {
widget.innerHTML = "";
}
}, this);
return this;
};
})();