// updateRoom.js
(function () {
/* global adventurejs A */
var p = adventurejs.Display.prototype;
/**
* Concatenate room name + player situation to status bar.
* @method adventurejs.Display#updateRoom
* @returns {adventurejs.Display} Returns the instance the method is called on (useful for chaining calls.)
* @chainable
*/
p.updateRoom = function Display_updateRoom() {
var player = this.game.getPlayer();
var situation = "";
var nest_asset = player.getNestAsset();
let room = this.game.getAsset(this.game.world._room);
if (nest_asset) {
situation = ` (${player.getPostureGerund()}
${player.getNestPreposition()}
${nest_asset.articlename})`;
} else if (player.isOnFloor()) {
situation = ` (${player.getPostureGerund()} on the floor)`;
}
// @FUTURE floating in water or zero-G
situation = situation ? `<span class='situation'>${situation}</span>` : "";
let name =
(room.is.dark && this.game.settings.name_for_dark_rooms
? this.game.settings.name_for_dark_rooms
: room.name) + (situation && situation);
this.roomEl.innerHTML = name;
return this;
};
})();