mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:37:46 +02:00
fix timing on startNearGrab entity-method call for cloned entities. Don't allow grabbing of other's equipped or worn entities
This commit is contained in:
parent
3c0243419b
commit
bf46960dc3
2 changed files with 22 additions and 0 deletions
|
@ -185,6 +185,7 @@ Script.include("/~/system/libraries/controllers.js");
|
||||||
var cloneID = cloneEntity(targetProps);
|
var cloneID = cloneEntity(targetProps);
|
||||||
if (cloneID !== null) {
|
if (cloneID !== null) {
|
||||||
var cloneProps = Entities.getEntityProperties(cloneID, DISPATCHER_PROPERTIES);
|
var cloneProps = Entities.getEntityProperties(cloneID, DISPATCHER_PROPERTIES);
|
||||||
|
cloneProps.id = cloneID;
|
||||||
this.grabbing = true;
|
this.grabbing = true;
|
||||||
this.targetEntityID = cloneID;
|
this.targetEntityID = cloneID;
|
||||||
this.startNearGrabEntity(cloneProps);
|
this.startNearGrabEntity(cloneProps);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
getEnabledModuleByName:true,
|
getEnabledModuleByName:true,
|
||||||
getGrabbableData:true,
|
getGrabbableData:true,
|
||||||
isAnothersAvatarEntity:true,
|
isAnothersAvatarEntity:true,
|
||||||
|
isAnothersChildEntity:true,
|
||||||
entityIsGrabbable:true,
|
entityIsGrabbable:true,
|
||||||
entityIsDistanceGrabbable:true,
|
entityIsDistanceGrabbable:true,
|
||||||
getControllerJointIndexCacheTime:true,
|
getControllerJointIndexCacheTime:true,
|
||||||
|
@ -302,11 +303,31 @@ isAnothersAvatarEntity = function (iaaeProps) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isAnothersChildEntity = function (iaceProps) {
|
||||||
|
while (iaceProps.parentID && iaceProps.parentID !== Uuid.NULL) {
|
||||||
|
if (Entities.getNestableType(iaceProps.parentID) == "avatar") {
|
||||||
|
if (iaceProps.parentID == MyAvatar.SELF_ID || iaceProps.parentID == MyAvatar.sessionUUID) {
|
||||||
|
return false; // not another's, it's mine.
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Entities.getNestableType(iaceProps.parentID) == "entity") {
|
||||||
|
var parentProps = Entities.getEntityProperties(iaceProps.parentID, DISPATCHER_PROPERTIES);
|
||||||
|
if (!parentProps) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parentProps.id = iaceProps.parentID;
|
||||||
|
iaceProps = parentProps;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
entityIsGrabbable = function (eigProps) {
|
entityIsGrabbable = function (eigProps) {
|
||||||
var grabbable = getGrabbableData(eigProps).grabbable;
|
var grabbable = getGrabbableData(eigProps).grabbable;
|
||||||
if (!grabbable ||
|
if (!grabbable ||
|
||||||
eigProps.locked ||
|
eigProps.locked ||
|
||||||
isAnothersAvatarEntity(eigProps) ||
|
isAnothersAvatarEntity(eigProps) ||
|
||||||
|
isAnothersChildEntity(eigProps) ||
|
||||||
FORBIDDEN_GRAB_TYPES.indexOf(eigProps.type) >= 0) {
|
FORBIDDEN_GRAB_TYPES.indexOf(eigProps.type) >= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue