// updateRoomImage.js
(function () {
/* global adventurejs A */
var p = adventurejs.Display.prototype;
/**
* Set Room image if there is one.
* @method adventurejs.Display#updateRoomImage
* @param {String} id 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.updateRoomImage = function Display_updateRoomImage(id) {
if ("undefined" === typeof id) {
id = this.game.getAsset(this.game.world._room).image;
}
if (!id) return this;
this.imagedocks.forEach(function (dock) {
if (dock.dataset.type && dock.dataset.type.toLowerCase() === "room") {
if (this.game.image_lookup[id]) {
dock.innerHTML = `<img src="${this.game.image_lookup[id]}" class="room_image id_${id}"/>`;
} else {
dock.innerHTML = "";
}
}
}, this);
return this;
};
})();