content/hifi-content/liv/dev/AC_Entity_Counter_Utility.js
2022-02-14 02:04:11 +01:00

27 lines
No EOL
863 B
JavaScript

var SEARCH_CENTER = {x: 0, y: -10, z: 0};
var SEARCH_RADIUS = 100;
var isInitialized = false;
var timeout = 1000;
var update = function(deltaTime) {
if (!isInitialized) {
if (Entities.serversExist() && Entities.canRez()) {
EntityViewer.setPosition(SEARCH_CENTER);
EntityViewer.setCenterRadius(SEARCH_RADIUS);
EntityViewer.queryOctree();
Script.setTimeout(function(){
var foundEntities = Entities.findEntities(SEARCH_CENTER, SEARCH_RADIUS).length;
print("AC Script found: " + foundEntities + " entities within " + SEARCH_RADIUS + "m of " + JSON.stringify(SEARCH_CENTER));
}, timeout);
isInitialized = true;
Script.update.disconnect(update);
}
}
};
Script.update.connect(update);