mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:36:56 +02:00
Add proper disabling to advanced movement script
This commit is contained in:
parent
39e4ad4300
commit
fec8049226
2 changed files with 43 additions and 1 deletions
|
@ -18,6 +18,7 @@ var mappingName, basicMapping, isChecked;
|
||||||
var TURN_RATE = 1000;
|
var TURN_RATE = 1000;
|
||||||
var MENU_ITEM_NAME = "Advanced Movement For Hand Controllers";
|
var MENU_ITEM_NAME = "Advanced Movement For Hand Controllers";
|
||||||
var SETTINGS_KEY = 'advancedMovementForHandControllersIsChecked';
|
var SETTINGS_KEY = 'advancedMovementForHandControllersIsChecked';
|
||||||
|
var isDisabled = false;
|
||||||
var previousSetting = Settings.getValue(SETTINGS_KEY);
|
var previousSetting = Settings.getValue(SETTINGS_KEY);
|
||||||
if (previousSetting === '' || previousSetting === false || previousSetting === 'false') {
|
if (previousSetting === '' || previousSetting === false || previousSetting === 'false') {
|
||||||
previousSetting = false;
|
previousSetting = false;
|
||||||
|
@ -146,4 +147,19 @@ HMD.displayModeChanged.connect(function(isHMDMode) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL = 'Hifi-Advanced-Movement-Disabler';
|
||||||
|
function handleMessage(channel, message, sender) {
|
||||||
|
if (channel == HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) {
|
||||||
|
if (message == 'disable') {
|
||||||
|
isDisabled = true;
|
||||||
|
} else if (message == 'enable') {
|
||||||
|
isDisabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL);
|
||||||
|
Messages.messageReceived.connect(handleHandMessages);
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
|
@ -216,6 +216,8 @@ stepDisableControllers.prototype = {
|
||||||
start: function(onFinish) {
|
start: function(onFinish) {
|
||||||
editEntitiesWithTag('door', { visible: true });
|
editEntitiesWithTag('door', { visible: true });
|
||||||
Menu.setIsOptionChecked("Overlays", false);
|
Menu.setIsOptionChecked("Overlays", false);
|
||||||
|
Controller.disableMapping('handControllerPointer-click');
|
||||||
|
Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'disable');
|
||||||
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both');
|
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both');
|
||||||
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
|
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
|
||||||
nearGrabEnabled: true,
|
nearGrabEnabled: true,
|
||||||
|
@ -230,6 +232,30 @@ stepDisableControllers.prototype = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var stepEnableControllers = function(name) {
|
||||||
|
this.tag = name;
|
||||||
|
this.shouldLog = false;
|
||||||
|
}
|
||||||
|
stepEnableControllers.prototype = {
|
||||||
|
start: function(onFinish) {
|
||||||
|
editEntitiesWithTag('door', { visible: false });
|
||||||
|
Menu.setIsOptionChecked("Overlays", true);
|
||||||
|
Controller.enableMapping('handControllerPointer-click');
|
||||||
|
Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'enable');
|
||||||
|
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none');
|
||||||
|
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
|
||||||
|
nearGrabEnabled: true,
|
||||||
|
holdEnabled: true,
|
||||||
|
farGrabEnabled: true,
|
||||||
|
}));
|
||||||
|
setControllerPartLayer('touchpad', 'blank');
|
||||||
|
setControllerPartLayer('tips', 'blank');
|
||||||
|
onFinish();
|
||||||
|
},
|
||||||
|
cleanup: function() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
|
@ -980,6 +1006,7 @@ TutorialManager = function() {
|
||||||
new stepTurnAround("turnAround"),
|
new stepTurnAround("turnAround"),
|
||||||
new stepTeleport("teleport"),
|
new stepTeleport("teleport"),
|
||||||
new stepFinish("finish"),
|
new stepFinish("finish"),
|
||||||
|
new stepEnableControllers("enableControllers"),
|
||||||
];
|
];
|
||||||
for (var i = 0; i < STEPS.length; ++i) {
|
for (var i = 0; i < STEPS.length; ++i) {
|
||||||
STEPS[i].cleanup();
|
STEPS[i].cleanup();
|
||||||
|
@ -1041,7 +1068,6 @@ TutorialManager = function() {
|
||||||
Script.scriptEnding.connect(function() {
|
Script.scriptEnding.connect(function() {
|
||||||
Controller.enableMapping('handControllerPointer-click');
|
Controller.enableMapping('handControllerPointer-click');
|
||||||
});
|
});
|
||||||
Controller.disableMapping('handControllerPointer-click');
|
|
||||||
|
|
||||||
// var entityID = '{be3d10a3-262a-4827-b30c-ec025c4325dc}';
|
// var entityID = '{be3d10a3-262a-4827-b30c-ec025c4325dc}';
|
||||||
// var token = new OwnershipToken(Math.random() * 100000, entityID, {
|
// var token = new OwnershipToken(Math.random() * 100000, entityID, {
|
||||||
|
|
Loading…
Reference in a new issue