Merge pull request #627 from Armored-Dragon/inspect.js-compatibility

inspect.js and mouselook.js compatibility
This commit is contained in:
ksuprynowicz 2023-09-22 07:47:15 +02:00 committed by GitHub
commit 7dc4fad55d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,8 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
var tempOff = false;
var altMode = false;
Camera.mouseLookChanged.connect(onMouseLookChanged);
function onMouseLookChanged(newMouseLook) {
@ -41,6 +43,21 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
function onKeyPressEvent(event) {
if (!hmd){
if(event.isAlt){
if (keysOnOverlay) return;
if (!mouseLookEnabled) return;
mouseLookOff();
Window.displayAnnouncement("Mouse look: Temporarily OFF");
tempOff = true;
altMode = true;
}
if (tempOff && altMode && ['left', 'right', 'up', 'down', 'esc', 'w', 'a', 's', 'd'].includes(event.text.toLowerCase())){
if (keysOnOverlay) return;
if (!mouseLookEnabled) return;
mouseLookOn();
tempOff = false;
altMode = false
}
if (event.text.toLowerCase() === 'm') {
if (!keysOnOverlay) {
if (mouseLookEnabled) {
@ -174,6 +191,12 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
}
}
Messages.messageReceived.connect(onMessageReceived);
function onMessageReceived(channel, message, sender, localOnly) {
if (channel === "Hifi-Away-Enable")
if (message === 'enable') mouseLookOn();
}
Script.scriptEnding.connect(onScriptEnding);
function onScriptEnding() {