mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
modified away script to use MyAvatar.isAway property
This commit is contained in:
parent
691f61983a
commit
a8f223518c
1 changed files with 29 additions and 20 deletions
|
@ -165,9 +165,36 @@ function goAway(fromStartup) {
|
||||||
if (!isEnabled || isAway) {
|
if (!isEnabled || isAway) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're entering away mode from some other state than startup, then we create our move timer immediately.
|
||||||
|
// However if we're just stating up, we need to delay this process so that we don't think the initial teleport
|
||||||
|
// is actually a move.
|
||||||
|
if (fromStartup === undefined || fromStartup === false) {
|
||||||
|
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
||||||
|
} else {
|
||||||
|
var WAIT_FOR_MOVE_ON_STARTUP = 3000; // 3 seconds
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
||||||
|
}, WAIT_FOR_MOVE_ON_STARTUP);
|
||||||
|
}
|
||||||
|
|
||||||
UserActivityLogger.toggledAway(true);
|
UserActivityLogger.toggledAway(true);
|
||||||
|
MyAvatar.isAway = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function goActive() {
|
||||||
|
if (!isAway) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserActivityLogger.toggledAway(false);
|
||||||
|
MyAvatar.isAway = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyAvatar.wentAway.connect(setAwayProperties)
|
||||||
|
MyAvatar.wentActive.connect(setActiveProperties)
|
||||||
|
|
||||||
|
function setAwayProperties() {
|
||||||
isAway = true;
|
isAway = true;
|
||||||
wasMuted = AudioDevice.getMuted();
|
wasMuted = AudioDevice.getMuted();
|
||||||
if (!wasMuted) {
|
if (!wasMuted) {
|
||||||
|
@ -189,27 +216,9 @@ function goAway(fromStartup) {
|
||||||
wasHmdMounted = HMD.mounted; // always remember the correct state
|
wasHmdMounted = HMD.mounted; // always remember the correct state
|
||||||
|
|
||||||
avatarPosition = MyAvatar.position;
|
avatarPosition = MyAvatar.position;
|
||||||
|
|
||||||
// If we're entering away mode from some other state than startup, then we create our move timer immediately.
|
|
||||||
// However if we're just stating up, we need to delay this process so that we don't think the initial teleport
|
|
||||||
// is actually a move.
|
|
||||||
if (fromStartup === undefined || fromStartup === false) {
|
|
||||||
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
|
||||||
} else {
|
|
||||||
var WAIT_FOR_MOVE_ON_STARTUP = 3000; // 3 seconds
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
|
||||||
}, WAIT_FOR_MOVE_ON_STARTUP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function goActive() {
|
function setActiveProperties() {
|
||||||
if (!isAway) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserActivityLogger.toggledAway(false);
|
|
||||||
|
|
||||||
isAway = false;
|
isAway = false;
|
||||||
if (!wasMuted) {
|
if (!wasMuted) {
|
||||||
AudioDevice.toggleMute();
|
AudioDevice.toggleMute();
|
||||||
|
|
Loading…
Reference in a new issue