mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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);
|
||||
if (cloneID !== null) {
|
||||
var cloneProps = Entities.getEntityProperties(cloneID, DISPATCHER_PROPERTIES);
|
||||
cloneProps.id = cloneID;
|
||||
this.grabbing = true;
|
||||
this.targetEntityID = cloneID;
|
||||
this.startNearGrabEntity(cloneProps);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
getEnabledModuleByName:true,
|
||||
getGrabbableData:true,
|
||||
isAnothersAvatarEntity:true,
|
||||
isAnothersChildEntity:true,
|
||||
entityIsGrabbable:true,
|
||||
entityIsDistanceGrabbable:true,
|
||||
getControllerJointIndexCacheTime:true,
|
||||
|
@ -302,11 +303,31 @@ isAnothersAvatarEntity = function (iaaeProps) {
|
|||
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) {
|
||||
var grabbable = getGrabbableData(eigProps).grabbable;
|
||||
if (!grabbable ||
|
||||
eigProps.locked ||
|
||||
isAnothersAvatarEntity(eigProps) ||
|
||||
isAnothersChildEntity(eigProps) ||
|
||||
FORBIDDEN_GRAB_TYPES.indexOf(eigProps.type) >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue