Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.js and mouselook.js compatibility #627

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions scripts/system/controllers/mouseLook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
ksuprynowicz marked this conversation as resolved.
Show resolved Hide resolved
}

Script.scriptEnding.connect(onScriptEnding);

function onScriptEnding() {
Expand Down
Loading