fix cloneEntity function

This commit is contained in:
Seth Alves 2019-03-11 12:38:54 -07:00
parent 2fb5e1ebc2
commit e515e9cc66
2 changed files with 9 additions and 10 deletions

View file

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

View file

@ -156,7 +156,9 @@ DISPATCHER_PROPERTIES = [
"grab.equippableIndicatorOffset", "grab.equippableIndicatorOffset",
"userData", "userData",
"avatarEntity", "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 // priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step