Add shouldRenderLocally to bat.js and fix findEntities

This commit is contained in:
Ryan Huffman 2015-11-02 15:13:07 -08:00
parent e3041f2667
commit 8b6db3b6c0
2 changed files with 5 additions and 1 deletions

View file

@ -5,11 +5,13 @@
this.startNearGrab = function() {
print("Started near grab!");
pitchingMachine.start();
MyAvatar.shouldRenderLocally = false;
};
this.releaseGrab = function() {
print("Stopped near grab!");
if (pitchingMachine) {
pitchingMachine.stop();
}
MyAvatar.shouldRenderLocally = true;
};
});

View file

@ -85,10 +85,12 @@ var PITCH_RATE = 5000;
function findEntities(properties, searchRadius) {
var entities = Entities.findEntities(MyAvatar.position, searchRadius);
var matchedEntities = [];
var keys = Object.keys(properties);
for (var i = 0; i < entities.length; ++i) {
var match = true;
var candidateProperties = Entities.getEntityProperties(entities[i], keys);
for (var key in properties) {
if (entities[key] != properties[key]) {
if (candidateProperties[key] != properties[key]) {
// This isn't a match, move to next entity
match = false;
break;