prevent continuous clone calls

This commit is contained in:
David Back 2018-05-16 11:36:57 -07:00
parent 6484c866f3
commit 6c946d7ac5

View file

@ -35,6 +35,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.lastUnexpectedChildrenCheckTime = 0;
this.robbed = false;
this.highlightedEntity = null;
this.cloneAllowed = true;
this.parameters = makeDispatcherModuleParameters(
500,
@ -272,6 +273,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) {
this.checkForUnexpectedChildren(controllerData);
this.robbed = false;
this.cloneAllowed = true;
return makeRunningValues(false, [], []);
}
@ -335,12 +337,14 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
var targetCloneable = entityIsCloneable(targetProps);
if (targetCloneable) {
var cloneID = cloneEntity(targetProps);
var cloneProps = Entities.getEntityProperties(cloneID);
this.grabbing = true;
this.targetEntityID = cloneID;
this.startNearParentingGrabEntity(controllerData, cloneProps);
if (this.cloneAllowed) {
var cloneID = cloneEntity(targetProps);
var cloneProps = Entities.getEntityProperties(cloneID);
this.grabbing = true;
this.targetEntityID = cloneID;
this.startNearParentingGrabEntity(controllerData, cloneProps);
this.cloneAllowed = false;
}
} else if (targetProps) {
this.grabbing = true;
this.startNearParentingGrabEntity(controllerData, targetProps);