Files
adarkroom/script/header.js
T
Michael Townsend 7ee96fd108 Expansion (#707)
This additional content explores the aftermath of an event in The Ensign. A large dungeon, The Executioner, reveals the fate of one of the Wanderers’ most powerful weapons though multiple wings, each ending with a unique boss encounter. The fabricator allows the player to craft powerful items out of alien alloy, introducing new combat mechanics.
2023-06-09 12:38:16 -04:00

35 lines
707 B
JavaScript

/**
* Module that takes care of header buttons
*/
var Header = {
init: function(options) {
this.options = $.extend(
this.options,
options
);
},
options: {}, // Nothing for now
canTravel: function() {
return $('div#header div.headerButton').length > 1;
},
addLocation: function(text, id, module, before) {
const toAdd = $('<div>').attr('id', "location_" + id)
.addClass('headerButton')
.text(text).click(function() {
if(Header.canTravel()) {
Engine.travelTo(module);
}
});
if (before && $(`#location_${before}`).length > 0) {
return toAdd.insertBefore(`#location_${before}`);
}
return toAdd.appendTo($('div#header'));
}
};