Add polish to the game
I added polish to the game. Hooray.
This commit is contained in:
parent
6bbfbd60d0
commit
e4584d0669
18 changed files with 651 additions and 86 deletions
48
js/loader.js
48
js/loader.js
|
@ -13,6 +13,8 @@
|
|||
decent basis for modding in the future.
|
||||
*/
|
||||
|
||||
mods = [];
|
||||
|
||||
legalFuncs = [
|
||||
"gravity",
|
||||
"cohesion",
|
||||
|
@ -47,9 +49,53 @@ function loadMod(stuff) {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
async function openMods(stuff) {
|
||||
// TODO: don't use prompt
|
||||
let url = prompt('Type in the URL to the JSON of the mod you want to load.');
|
||||
loadMod(await (await fetch(url)).json())
|
||||
}*/
|
||||
|
||||
function openMods() {
|
||||
|
||||
document.querySelector("#mod-loader-modal").classList.add("opened")
|
||||
|
||||
}
|
||||
function closeMods() {
|
||||
|
||||
document.querySelector("#mod-loader-modal").classList.remove("opened")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function loadModFromForm() {
|
||||
|
||||
document.querySelector("#mod-form input").disabled = true;
|
||||
let url = document.querySelector("#mod-form input").value;
|
||||
try {
|
||||
var mod = await fetch(url).then(e => e.json());
|
||||
// do stuff here, check if mod is ok, etc...
|
||||
alert("Mod loaded!")
|
||||
|
||||
mods.push(mod)
|
||||
} catch(err) {
|
||||
alert("That mod isn't valid. Check the mod, and try again.")
|
||||
}
|
||||
document.querySelector("#mod-form input").disabled = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
document.querySelectorAll(".mod-loader-tab").forEach(function(element, index){
|
||||
|
||||
element.onclick = function() {
|
||||
|
||||
document.querySelectorAll("#mod-loader-modal .selected-group").forEach(function(e) {e.classList.remove("selected-group")})
|
||||
element.classList.add("selected-group");
|
||||
document.querySelector(".mod-loader-tab-content:nth-child("+(index+1)+")").classList.add("selected-group");
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue