mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +02:00
add entityIsEquipped utils for grab.js check
This commit is contained in:
parent
4a08a6c147
commit
07fb604090
2 changed files with 9 additions and 1 deletions
|
@ -567,7 +567,7 @@ Grabber.prototype.moveEventProcess = function() {
|
|||
}
|
||||
|
||||
if (!this.actionID) {
|
||||
if (!entityIsGrabbedByOther(this.entityID) && Entities.getEntityProperties(this.entityID, ['parentID']).parentID !== MyAvatar.SELF_ID) {
|
||||
if (!entityIsGrabbedByOther(this.entityID) && !entityIsEquipped(this.entityID)) {
|
||||
this.actionID = Entities.addAction("far-grab", this.entityID, actionArgs);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -384,6 +384,14 @@ distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
|||
return Vec3.distance(v, localPoint);
|
||||
};
|
||||
|
||||
entityIsEquipped = function(entityID) {
|
||||
var rightEquipEntity = getEnabledModuleByName("RightEquipEntity");
|
||||
var leftEquipEntity = getEnabledModuleByName("LeftEquipEntity");
|
||||
var equippedInRightHand = rightEquipEntity ? rightEquipEntity.targetEntityID === entityID : false;
|
||||
var equippedInLeftHand = leftEquipEntity ? leftEquipEntity.targetEntityID === entityID : false;
|
||||
return equippedInRightHand || equippedInLeftHand;
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
makeDispatcherModuleParameters: makeDispatcherModuleParameters,
|
||||
|
|
Loading…
Reference in a new issue