support multiple scenes and passing between them

This commit is contained in:
Rusty Striker 2025-07-04 13:23:22 +03:00
parent 2d46cbb4d0
commit 838c89ac73
Signed by: RustyStriker
GPG key ID: 87E4D691632DFF15
8 changed files with 124 additions and 67 deletions

View file

@ -111,8 +111,11 @@ tavern.onlogin = (s) => {
login.style.display = 'none';
game.style.display = 'flex';
// get last 50 msgs (i think that is enough for now) when we get in
// TODO: Maybe move this into the server itself? that is a lot of stuff that we know are gonna happen...
// For now i'll keep it like that tho
tavern.get_last_msgs(50);
tavern.get_current_scene();
// TODO: Perhaps figure out a way to show a certain scene? maybe on the server it would make more sense
tavern.get_scene_list();
}
else {
alert("Invalid username or password!");
@ -210,6 +213,14 @@ tavern.onshowscene = (show) => {
tavern.onspawntoken(token);
}
}
tavern.onscenelist = (list) => {
console.log(list);
let div = document.getElementById('scene-list');
div.innerHTML = '';
for (let scene of list.scenes) {
div.innerHTML += `<button onclick='tavern.get_scene(${scene[0]});'>${scene[1]}</button>`;
}
}
function onLoginClick() {
let username = document.getElementById('login-username').value;
let pass = document.getElementById('login-pass').value;