protect beam disabler from others

This commit is contained in:
James B. Pollack 2015-11-24 13:35:53 -08:00
parent 50c1786e9b
commit be7d52a773

View file

@ -1216,7 +1216,6 @@ Controller.enableMapping(MAPPING_NAME);
var handToDisable = 'none';
function update() {
// print('disabled in update:::'+handToDisable)
if (handToDisable !== 0) {
leftController.update();
}
@ -1228,14 +1227,17 @@ function update() {
Messages.subscribe('Hifi-Beam-Disabler');
handleBeamDisablerMessages = function(channel, message, sender) {
print('GOT MESSAGE:::'+message)
handToDisable = message;
if (message === 'left') {
handToDisable = 1;
}
if (message === 'right') {
handToDisable = 0;
if (sender === MyAvatar.sessionUUID) {
handToDisable = message;
if (message === 'left') {
handToDisable = 1;
}
if (message === 'right') {
handToDisable = 0;
}
}
}
Messages.messageReceived.connect(handleBeamDisablerMessages);