Merge pull request #15155 from sethalves/fix-clonables

Fix cloneables
This commit is contained in:
Shannon Romano 2019-03-11 14:17:20 -07:00 committed by GitHub
commit 864c37d310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View file

@ -5,8 +5,8 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global entityIsCloneable:true, getGrabbableData:true, cloneEntity:true, propsAreCloneDynamic:true, Script,
propsAreCloneDynamic:true, Entities*/
/* global entityIsCloneable:true, cloneEntity:true, propsAreCloneDynamic:true, Script,
propsAreCloneDynamic:true, Entities, Uuid */
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -47,13 +47,10 @@ propsAreCloneDynamic = function(props) {
};
cloneEntity = function(props) {
var entityToClone = props.id;
var props = Entities.getEntityProperties(entityToClone, ['certificateID', 'certificateType'])
var certificateID = props.certificateID;
// ensure entity is cloneable and does not have a certificate ID, whereas cloneable limits
// will now be handled by the server where the entity add will fail if limit reached
if (entityIsCloneable(props) && (!!certificateID || props.certificateType.indexOf('domainUnlimited') >= 0)) {
var cloneID = Entities.cloneEntity(entityToClone);
var entityIDToClone = props.id;
if (entityIsCloneable(props) &&
(Uuid.isNull(props.certificateID) || props.certificateType.indexOf('domainUnlimited') >= 0)) {
var cloneID = Entities.cloneEntity(entityIDToClone);
return cloneID;
}
return null;

View file

@ -156,7 +156,9 @@ DISPATCHER_PROPERTIES = [
"grab.equippableIndicatorOffset",
"userData",
"avatarEntity",
"owningAvatarID"
"owningAvatarID",
"certificateID",
"certificateType"
];
// priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step

View file

@ -1048,6 +1048,7 @@
// Track grabbed state and item.
switch (message.action) {
case "grab":
case "equip":
grabbingHand = HAND_NAMES.indexOf(message.joint);
grabbedItem = message.grabbedEntity;
break;
@ -1056,7 +1057,7 @@
grabbedItem = null;
break;
default:
error("Unexpected grab message!");
error("Unexpected grab message: " + JSON.stringify(message));
return;
}
@ -1144,4 +1145,4 @@
setUp();
Script.scriptEnding.connect(tearDown);
}());
}());