mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
try to fix double-distance-grabbing lockout
This commit is contained in:
parent
5b970e6b1a
commit
880d92ee64
1 changed files with 11 additions and 12 deletions
|
@ -45,26 +45,25 @@ var IDENTITY_QUAT = {
|
||||||
z: 0,
|
z: 0,
|
||||||
w: 0
|
w: 0
|
||||||
};
|
};
|
||||||
var ACTION_LIFETIME = 120; // 2 minutes
|
var ACTION_LIFETIME = 10; // seconds
|
||||||
|
|
||||||
function getTag() {
|
function getTag() {
|
||||||
return "grab-" + MyAvatar.sessionUUID;
|
return "grab-" + MyAvatar.sessionUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
function entityIsGrabbedByOther(entityID) {
|
function entityIsGrabbedByOther(entityID) {
|
||||||
|
// by convention, a distance grab sets the tag of its action to be grab-*owner-session-id*.
|
||||||
var actionIDs = Entities.getActionIDs(entityID);
|
var actionIDs = Entities.getActionIDs(entityID);
|
||||||
var actionIndex;
|
for (var actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
||||||
var actionID;
|
var actionID = actionIDs[actionIndex];
|
||||||
var actionArguments;
|
var actionArguments = Entities.getActionArguments(entityID, actionID);
|
||||||
var tag;
|
var tag = actionArguments["tag"];
|
||||||
for (actionIndex = 0; actionIndex < actionIDs.length; actionIndex++) {
|
if (tag == getTag()) {
|
||||||
actionID = actionIDs[actionIndex];
|
// we see a grab-*uuid* shaped tag, but it's our tag, so that's okay.
|
||||||
actionArguments = Entities.getActionArguments(entityID, actionID);
|
|
||||||
tag = actionArguments.tag;
|
|
||||||
if (tag === getTag()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tag.slice(0, 5) === "grab-") {
|
if (tag.slice(0, 5) == "grab-") {
|
||||||
|
// we see a grab-*uuid* shaped tag and it's not ours, so someone else is grabbing it.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,4 +529,4 @@ Controller.mousePressEvent.connect(pressEvent);
|
||||||
Controller.mouseMoveEvent.connect(moveEvent);
|
Controller.mouseMoveEvent.connect(moveEvent);
|
||||||
Controller.mouseReleaseEvent.connect(releaseEvent);
|
Controller.mouseReleaseEvent.connect(releaseEvent);
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
|
|
Loading…
Reference in a new issue