mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 12:23:24 +02:00
Reset player details when domain restarts or user teleports
This commit is contained in:
parent
7dddd266ba
commit
8bbce53f74
1 changed files with 26 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
isDialogDisplayed = false,
|
||||
tablet,
|
||||
button,
|
||||
isConnected,
|
||||
|
||||
CountdownTimer,
|
||||
RecordingIndicator,
|
||||
|
@ -436,6 +437,14 @@
|
|||
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
||||
}
|
||||
|
||||
function reset() {
|
||||
playerIDs = [];
|
||||
playerIsPlayings = [];
|
||||
playerRecordings = [];
|
||||
playerTimestamps = [];
|
||||
Dialog.updatePlayerDetails(playerIsPlayings, playerRecordings, playerIDs);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
// Messaging with AC scripts.
|
||||
Messages.messageReceived.connect(onMessageReceived);
|
||||
|
@ -455,6 +464,7 @@
|
|||
playRecording: playRecording,
|
||||
stopPlayingRecording: stopPlayingRecording,
|
||||
numberOfPlayers: numberOfPlayers,
|
||||
reset: reset,
|
||||
setUp: setUp,
|
||||
tearDown: tearDown
|
||||
};
|
||||
|
@ -584,6 +594,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onUpdate() {
|
||||
if (isConnected !== Window.location.isConnected) {
|
||||
// Server restarted or domain changed.
|
||||
isConnected = !isConnected;
|
||||
if (!isConnected) {
|
||||
// Clear dialog.
|
||||
Player.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
if (!tablet) {
|
||||
|
@ -606,6 +627,9 @@
|
|||
Dialog.setUp();
|
||||
Player.setUp();
|
||||
Recorder.setUp(Player.playRecording);
|
||||
|
||||
isConnected = Window.location.isConnected;
|
||||
Script.update.connect(onUpdate);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
@ -613,6 +637,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Script.update.disconnect(onUpdate);
|
||||
|
||||
Recorder.tearDown();
|
||||
Player.tearDown();
|
||||
Dialog.tearDown();
|
||||
|
|
Loading…
Reference in a new issue