mirror of
https://github.com/overte-org/overte.git
synced 2025-04-13 14:52:19 +02:00
Merge pull request #16318 from MiladNazeri/dev-2082/cannont-click-yourself-in-third-person-for-nametag
dev-2082/cannot-click-yourself-in-third-person-for-nametag
This commit is contained in:
commit
a5caa36f07
1 changed files with 50 additions and 0 deletions
|
@ -22,6 +22,31 @@ var SECONDS_IN_MINUTE = 60;
|
|||
// Delete after 5 minutes in case a nametag is hanging around in on mode
|
||||
var ALWAYS_ON_MAX_LIFETIME_IN_SECONDS = 5 * SECONDS_IN_MINUTE;
|
||||
|
||||
// *************************************
|
||||
// START STARTUP/SHUTDOWN
|
||||
// *************************************
|
||||
// #region STARTUP/SHUTDOWN
|
||||
|
||||
|
||||
// Connect the camera mode updated signal on startup
|
||||
function startup() {
|
||||
Camera.modeUpdated.connect(handleCameraModeChanged);
|
||||
cameraModeUpdatedSignalConnected = true;
|
||||
|
||||
Script.scriptEnding.connect(shutdown);
|
||||
}
|
||||
|
||||
startup();
|
||||
|
||||
function shutdown() {
|
||||
maybeDisconnectCameraModeUpdatedSignal();
|
||||
}
|
||||
|
||||
|
||||
// *************************************
|
||||
// END STARTUP/SHUTDOWN
|
||||
// *************************************
|
||||
|
||||
// *************************************
|
||||
// START UTILTY
|
||||
// *************************************
|
||||
|
@ -197,6 +222,27 @@ function toggleInterval() {
|
|||
}
|
||||
|
||||
|
||||
// Disconnect the camera mode updated signal if we have one connected for the selfie mode
|
||||
var cameraModeUpdatedSignalConnected = false;
|
||||
function maybeDisconnectCameraModeUpdatedSignal() {
|
||||
if (cameraModeUpdatedSignalConnected) {
|
||||
Camera.modeUpdated.disconnect(handleCameraModeChanged);
|
||||
cameraModeUpdatedSignalConnected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Turn on the nametag for yourself if you are in selfie mode, other wise delete it
|
||||
function handleCameraModeChanged(mode) {
|
||||
if (mode === "selfie") {
|
||||
if (avatarNametagMode === "alwaysOn") {
|
||||
add(MyAvatar.sessionUUID);
|
||||
}
|
||||
} else {
|
||||
maybeRemove(MyAvatar.sessionUUID);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle checking to see if we should add or delete nametags in persistent mode
|
||||
var alwaysOnAvatarDistanceCheck = false;
|
||||
var DISTANCE_CHECK_INTERVAL_MS = 1000;
|
||||
|
@ -215,6 +261,10 @@ function handleAlwaysOnMode(shouldTurnOnAlwaysOnMode) {
|
|||
});
|
||||
maybeClearAlwaysOnAvatarDistanceCheck();
|
||||
alwaysOnAvatarDistanceCheck = Script.setInterval(maybeAddOrRemoveIntervalCheck, DISTANCE_CHECK_INTERVAL_MS);
|
||||
|
||||
if (Camera.mode === "selfie") {
|
||||
add(MyAvatar.sessionUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue