Przeglądaj źródła

Check the 'scene' parameter for a base64 encoded scene to load

tags/v0.1.0
Fen Dweller 5 lat temu
rodzic
commit
492a80dc67
1 zmienionych plików z 22 dodań i 1 usunięć
  1. +22
    -1
      macrovision.js

+ 22
- 1
macrovision.js Wyświetl plik

@@ -878,7 +878,28 @@ document.addEventListener("DOMContentLoaded", () => {
unitSelector.appendChild(option);
});

scenes["Demo"]();
param = new URL(window.location.href).searchParams.get("scene");

if (param === null)
scenes["Demo"]();
else {
try {
const data = JSON.parse(atob(param));
if (data.entities === undefined) {
return;
}
if (data.world === undefined) {
return;
}

importScene(data);
} catch (err) {
console.error(err);
scenes["Demo"]();

// probably wasn't valid data
}
}
fitWorld();
document.querySelector("#world").addEventListener("wheel", e => {



Ładowanie…
Anuluj
Zapisz