Whitespace and jslinting.

This commit is contained in:
Howard Stearns 2016-02-01 11:28:51 -08:00
parent 11d80cdc94
commit d8069b6dbf
3 changed files with 48 additions and 48 deletions

View file

@ -14,7 +14,7 @@
var vector = Vec3.subtract(ball, me);
if (Vec3.length(vector) < distanceAllowance) {
Entities.editEntity(entityID, {velocity: Vec3.multiply(distanceScale, Vec3.normalize(vector))});
Entities.editEntity(entityID, {velocity: Vec3.multiply(distanceScale, Vec3.normalize(vector))});
}
}
@ -25,7 +25,7 @@
if (userData) {
distanceRate = userData.distanceRate || distanceRate;
distanceAllowance = userData.distanceAllowance || distanceAllowance;
distanceScale = userData.distanceScale || distanceScale;
distanceScale = userData.distanceScale || distanceScale;
}
// run all the time by everyone:

View file

@ -19,37 +19,37 @@ var ROWS_X = 17;
var ROWS_Y = 10;
var ROWS_Z = 10;
// Entities will be populated from this list set by the script writer for different tests.
var TYPES_TO_USE = [ 'Box', 'Sphere'];
var TYPES_TO_USE = ['Box', 'Sphere'];
switch ('primitives') { // Quickly override the above by putting here one of the following case strings.
case 'particles':
TYPES_TO_USE = ['ParticleEffect'];
ROWS_X = ROWS_Z = 6;
break;
case 'lights':
TYPES_TO_USE = ['Light'];
ROWS_X = ROWS_Y = ROWS_Z = 5;
break;
case 'blocks': // 376 triangles/entity
TYPES_TO_USE = ["http://s3.amazonaws.com/hifi-public/marketplace/hificontent/Games/blocks/block.fbx"];
ROWS_X = ROWS_Y = ROWS_Z = 10;
break;
case 'ramp': // 1,002 triangles/entity
TYPES_TO_USE = ["http://headache.hungry.com/~seth/hifi/curved-ramp.obj"];
ROWS_X = ROWS_Y = 10;
ROWS_Z = 9;
break;
case 'trees': // 12k triangles/entity
TYPES_TO_USE = ["https://hifi-content.s3.amazonaws.com/ozan/dev/sets/lowpoly_island/CypressTreeGroup.fbx"];
ROWS_X = ROWS_Z = 6;
ROWS_Y = 1;
break;
case 'web':
TYPES_TO_USE = ['Web'];
ROWS_X = ROWS_Z = 5;
ROWS_Y = 3;
break;
default:
// Just using values from above.
case 'particles':
TYPES_TO_USE = ['ParticleEffect'];
ROWS_X = ROWS_Z = 6;
break;
case 'lights':
TYPES_TO_USE = ['Light'];
ROWS_X = ROWS_Y = ROWS_Z = 5;
break;
case 'blocks': // 376 triangles/entity
TYPES_TO_USE = ["http://s3.amazonaws.com/hifi-public/marketplace/hificontent/Games/blocks/block.fbx"];
ROWS_X = ROWS_Y = ROWS_Z = 10;
break;
case 'ramp': // 1,002 triangles/entity
TYPES_TO_USE = ["http://headache.hungry.com/~seth/hifi/curved-ramp.obj"];
ROWS_X = ROWS_Y = 10;
ROWS_Z = 9;
break;
case 'trees': // 12k triangles/entity
TYPES_TO_USE = ["https://hifi-content.s3.amazonaws.com/ozan/dev/sets/lowpoly_island/CypressTreeGroup.fbx"];
ROWS_X = ROWS_Z = 6;
ROWS_Y = 1;
break;
case 'web':
TYPES_TO_USE = ['Web'];
ROWS_X = ROWS_Z = 5;
ROWS_Y = 3;
break;
default:
// Just using values from above.
}
// Matrix will be axis-aligned, approximately all in this field of view.
// As special case, if zero, grid is centered above your head.

View file

@ -17,7 +17,7 @@ var Vec3, Quat, MyAvatar, Entities, Camera, Script, print;
// a moment -- that's why they are in a sparse grid.
var USE_FLAT_FLOOR = true; // Give 'em a flat place to settle on.
var ROWS_X = 30;
var ROWS_X = 30;
var ROWS_Z = 30;
var SEPARATION = 1; // meters
var LIFETIME = 60; // seconds
@ -61,13 +61,13 @@ var parameters = JSON.stringify({
var startTime = new Date();
if (USE_FLAT_FLOOR) {
Entities.addEntity({
type: 'Box',
name: 'keepAwayFloor',
lifetime: LIFETIME,
collisionsWillMove: false,
color: {red: 255, green: 0, blue: 0},
position: Vec3.sum(origin, {x: xDim / 2, y: -1 - HOW_FAR_UP, z: zDim / 2}),
dimensions: {x: xDim + SEPARATION, y: 0.2, z: zDim + SEPARATION}
type: 'Box',
name: 'keepAwayFloor',
lifetime: LIFETIME,
collisionsWillMove: false,
color: {red: 255, green: 0, blue: 0},
position: Vec3.sum(origin, {x: xDim / 2, y: -1 - HOW_FAR_UP, z: zDim / 2}),
dimensions: {x: xDim + SEPARATION, y: 0.2, z: zDim + SEPARATION}
});
}
Script.setInterval(function () {
@ -75,17 +75,17 @@ Script.setInterval(function () {
return;
}
var i, numToCreate = Math.min(RATE_PER_SECOND * (SCRIPT_INTERVAL / 1000.0), totalToCreate - totalCreated);
var i, properties, numToCreate = Math.min(RATE_PER_SECOND * (SCRIPT_INTERVAL / 1000.0), totalToCreate - totalCreated);
for (i = 0; i < numToCreate; i++) {
properties = {
userData: parameters,
type: TYPE,
name: "keepAway-" + totalCreated,
position: {
x: origin.x + SIZE + (x * SEPARATION),
y: origin.y,
z: origin.z + SIZE + (z * SEPARATION)
},
position: {
x: origin.x + SIZE + (x * SEPARATION),
y: origin.y,
z: origin.z + SIZE + (z * SEPARATION)
},
dimensions: {x: SIZE, y: SIZE, z: SIZE},
color: {red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255},
velocity: VELOCITY,
@ -94,7 +94,7 @@ Script.setInterval(function () {
gravity: GRAVITY,
collisionsWillMove: true,
lifetime: LIFETIME,
script: Script.resolvePath("../../entityScripts/simpleKeepAway.js")
script: Script.resolvePath("../../entityScripts/simpleKeepAway.js")
};
Entities.addEntity(properties);
totalCreated++;
@ -102,7 +102,7 @@ Script.setInterval(function () {
x++;
if (x === ROWS_X) {
x = 0;
z++;
z++;
print("Created: " + totalCreated);
}
if (z === ROWS_Z) {