Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { getItems } from "./item.js"
import { getModules } from "./module.js"
import { getPlanets } from "./planet.js"
import { getRecipes } from "./recipe.js"
import { currentMod, MODIFICATIONS, renderDataSetOptions, renderSettings } from "./settings.js"
import { currentMod, MODIFICATIONS, addOverrideOptions, renderDataSetOptions, renderSettings } from "./settings.js"
import { OVERRIDE } from "./override.js"

function reset() {
window.location.hash = ""
Expand Down Expand Up @@ -109,6 +110,9 @@ function loadData(modName, settings) {

export function init() {
let settings = loadSettings(window.location.hash)
if (OVERRIDE != null) {
addOverrideOptions(OVERRIDE)
}
renderDataSetOptions(settings)
loadData(currentMod(), settings)
}
16 changes: 16 additions & 0 deletions override.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*Copyright 2015-2019 Kirk McDonald

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/
"use strict"

export let OVERRIDE = null
8 changes: 8 additions & 0 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ export let MODIFICATIONS = new Map([

let DEFAULT_MODIFICATION = "2-0-10"

export function addOverrideOptions(version) {
var tag = "local-" + version.replace(/\./g, "-")
MODIFICATIONS.set(tag, new Modification("Local game data " + version, "local-" + version + ".json", false))
MODIFICATIONS.set(tag + "x", new Modification("Local game data " + version + " - Expensive", "local-" + version + "-expensive.json", false))
DEFAULT_MODIFICATION = tag
}


// Ideally we'd write this as a generalized function, but for now we can hard-
// code these version upgrades.
var modUpdates = new Map([
Expand Down