got rid of wasteful network calls

This commit is contained in:
Eric Levin 2015-10-09 08:23:44 -07:00
parent 948b37d681
commit 2b34c5a917
2 changed files with 2520 additions and 2465 deletions

View file

@ -52,6 +52,7 @@
};
MasterReset = function() {
var resetKey = "resetMe";
var GRABBABLE_DATA_KEY = "grabbableKey";
@ -220,12 +221,12 @@
y: 0.01,
z: 0.1
},
lifespan: 1
});
setEntityCustomData(resetKey, fire, {
lifespan: 1,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
}
@ -266,15 +267,16 @@
},
collisionsWillMove: true,
ignoreForCollisions: false,
compoundShapeURL: rackCollisionHullURL
});
setEntityCustomData(resetKey, rack, {
compoundShapeURL: rackCollisionHullURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
});
},
grabbableKey: {
grabbable: true
}
setEntityCustomData(GRABBABLE_DATA_KEY, rack, {
grabbable: false
})
});
var collidingBalls = [];
@ -315,14 +317,15 @@
collisionsWillMove: true,
ignoreForCollisions: false,
modelURL: basketballURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
collidingBalls.push(collidingBall);
originalBallPositions.push(position);
setEntityCustomData(resetKey, collidingBall, {
resetMe: true
});
}
}
@ -413,11 +416,11 @@
visible: false,
collisionsWillMove: false,
ignoreForCollisions: true,
});
setEntityCustomData(resetKey, targetIntervalClearer, {
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
var targets = [];
@ -451,13 +454,15 @@
compoundShapeURL: COLLISION_HULL_URL,
position: position,
rotation: rotation,
script: targetsScriptURL
script: targetsScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
};
var target = Entities.addEntity(targetProperties);
targets.push(target);
setEntityCustomData(resetKey, target, {
resetMe: true
});
}
}
@ -483,13 +488,15 @@
compoundShapeURL: COLLISION_HULL_URL,
position: originalPositions[index],
rotation: rotation,
script: targetsScriptURL
script: targetsScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
};
var target = Entities.addEntity(targetProperties);
targets[index] = target;
setEntityCustomData(resetKey, target, {
resetMe: true
});
}
});
@ -544,11 +551,13 @@
y: 0.50762706995010376,
z: 0.90716040134429932
},
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
setEntityCustomData(resetKey, cat, {
resetMe: true
});
}
function createFlashlight(position) {
@ -577,11 +586,13 @@
z: 0
},
shapeType: 'box',
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
setEntityCustomData(resetKey, flashlight, {
resetMe: true
});
}
@ -618,12 +629,14 @@
x: 0.10546875,
y: 0.032372996211051941,
z: 0.16242524981498718
}
});
setEntityCustomData(resetKey, lightSwitchHall, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
on: true,
type: "Hall Light"
}
})
});
var sconceLight1 = Entities.addEntity({
@ -644,12 +657,13 @@
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight1, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Hall Light",
type: "Hall Light"
}
})
});
var sconceLight2 = Entities.addEntity({
@ -670,15 +684,15 @@
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight2, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Hall Light",
type: "Hall Light"
}
})
});
rotation = {
w: 0.20082402229309082,
x: 0.20082402229309082,
@ -708,16 +722,19 @@
x: 0.10546875,
y: 0.032372996211051941,
z: 0.16242524981498718
}
});
setEntityCustomData(resetKey, lightSwitchGarage, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
on: true,
type: "Garage Light"
}
})
});
var sconceLight3 = Entities.addEntity({
type: "Light",
position: {
@ -737,16 +754,16 @@
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight3, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
var sconceLight4 = Entities.addEntity({
type: "Light",
position: {
@ -765,12 +782,13 @@
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight4, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
var sconceLight5 = Entities.addEntity({
@ -791,12 +809,13 @@
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight5, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
}
@ -830,7 +849,12 @@
z: 0
},
shapeType: "box",
collisionsWillMove: true
collisionsWillMove: true,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
};
var dice1 = Entities.addEntity(diceProps);
@ -842,13 +866,6 @@
var dice2 = Entities.addEntity(diceProps);
setEntityCustomData(resetKey, dice1, {
resetMe: true
});
setEntityCustomData(resetKey, dice2, {
resetMe: true
});
}
@ -882,17 +899,18 @@
linearDamping: 1,
angularDamping: 10,
mass: 10,
});
setEntityCustomData(resetKey, gate1, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, gate1, {
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbable: false
}
})
});
var rotation2 = Quat.fromPitchYawRollDegrees(0, -16, 0);
var gate2 = Entities.addEntity({
name: 'Front Door Fence',
@ -919,14 +937,14 @@
linearDamping: 1,
angularDamping: 10,
mass: 10,
});
setEntityCustomData(resetKey, gate2, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, gate2, {
grabbable: false
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbable: true
}
})
});
}
@ -960,10 +978,11 @@
z: 0.47
},
collisionsWillMove: true,
});
setEntityCustomData(resetKey, pingPongGun, {
resetMe: true
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
}
@ -994,15 +1013,15 @@
y: 3.99,
z: 3.79
},
compoundShapeURL: hoopCollisionHullURL
});
setEntityCustomData(resetKey, hoop, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, hoop, {
compoundShapeURL: hoopCollisionHullURL,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbaleKey: {
grabbable: false
}
})
});
}
@ -1032,12 +1051,15 @@
//Look into why bubble wand is going through table when gravity is enabled
// gravity: {x: 0, y: -3.5, z: 0},
// velocity: {x: 0, y: -0.01, z:0},
script: wandScriptURL
script: wandScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createBasketBall(position) {
@ -1068,12 +1090,14 @@
y: -0.01,
z: 0
},
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav"
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createDoll(position) {
@ -1103,12 +1127,14 @@
y: -0.1,
z: 0
},
collisionsWillMove: true
collisionsWillMove: true,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createSprayCan(position) {
@ -1137,11 +1163,12 @@
x: 0,
y: -1,
z: 0
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
});
setEntityCustomData(resetKey, entity, {
resetMe: true
})
});
}
@ -1171,16 +1198,15 @@
y: 0,
z: 0
},
linearDamping: 0.4
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, entity, {
grabbable: false
linearDamping: 0.4,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbale: false
}
})
});
}
@ -1215,16 +1241,17 @@
y: 0,
z: 0
},
linearDamping: 0.2
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, entity, {
linearDamping: 0.2,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbaleKey: {
grabbable: false
}
})
});
}
function createBlocks(position) {
@ -1268,7 +1295,7 @@
y: 0.05,
z: 0.25
}
}, ];
},];
var modelURL, entity;
for (i = 0; i < blockTypes.length; i++) {
@ -1296,13 +1323,14 @@
x: 0,
y: -0.01,
z: 0
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
//customKey, id, data
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
}
}

View file

@ -193,12 +193,12 @@ MasterReset = function() {
y: 0.01,
z: 0.1
},
lifespan: 1
});
setEntityCustomData(resetKey, fire, {
lifespan: 1,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
}
@ -239,15 +239,16 @@ MasterReset = function() {
},
collisionsWillMove: true,
ignoreForCollisions: false,
compoundShapeURL: rackCollisionHullURL
});
setEntityCustomData(resetKey, rack, {
compoundShapeURL: rackCollisionHullURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
});
},
grabbableKey: {
grabbable: true
}
setEntityCustomData(GRABBABLE_DATA_KEY, rack, {
grabbable: false
})
});
var collidingBalls = [];
@ -288,14 +289,15 @@ MasterReset = function() {
collisionsWillMove: true,
ignoreForCollisions: false,
modelURL: basketballURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
collidingBalls.push(collidingBall);
originalBallPositions.push(position);
setEntityCustomData(resetKey, collidingBall, {
resetMe: true
});
}
}
@ -386,11 +388,11 @@ MasterReset = function() {
visible: false,
collisionsWillMove: false,
ignoreForCollisions: true,
});
setEntityCustomData(resetKey, targetIntervalClearer, {
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
var targets = [];
@ -424,13 +426,15 @@ MasterReset = function() {
compoundShapeURL: COLLISION_HULL_URL,
position: position,
rotation: rotation,
script: targetsScriptURL
script: targetsScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
};
var target = Entities.addEntity(targetProperties);
targets.push(target);
setEntityCustomData(resetKey, target, {
resetMe: true
});
}
}
@ -456,13 +460,15 @@ MasterReset = function() {
compoundShapeURL: COLLISION_HULL_URL,
position: originalPositions[index],
rotation: rotation,
script: targetsScriptURL
script: targetsScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
};
var target = Entities.addEntity(targetProperties);
targets[index] = target;
setEntityCustomData(resetKey, target, {
resetMe: true
});
}
});
@ -517,11 +523,13 @@ MasterReset = function() {
y: 0.50762706995010376,
z: 0.90716040134429932
},
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
setEntityCustomData(resetKey, cat, {
resetMe: true
});
}
function createFlashlight(position) {
@ -550,11 +558,13 @@ MasterReset = function() {
z: 0
},
shapeType: 'box',
userData: JSON.stringify({
resetMe: {
resetMe: true
}
})
});
setEntityCustomData(resetKey, flashlight, {
resetMe: true
});
}
@ -591,12 +601,14 @@ MasterReset = function() {
x: 0.10546875,
y: 0.032372996211051941,
z: 0.16242524981498718
}
});
setEntityCustomData(resetKey, lightSwitchHall, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
on: true,
type: "Hall Light"
}
})
});
var sconceLight1 = Entities.addEntity({
@ -617,12 +629,13 @@ MasterReset = function() {
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight1, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Hall Light",
type: "Hall Light"
}
})
});
var sconceLight2 = Entities.addEntity({
@ -643,15 +656,15 @@ MasterReset = function() {
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight2, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Hall Light",
type: "Hall Light"
}
})
});
rotation = {
w: 0.20082402229309082,
x: 0.20082402229309082,
@ -681,16 +694,19 @@ MasterReset = function() {
x: 0.10546875,
y: 0.032372996211051941,
z: 0.16242524981498718
}
});
setEntityCustomData(resetKey, lightSwitchGarage, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
on: true,
type: "Garage Light"
}
})
});
var sconceLight3 = Entities.addEntity({
type: "Light",
position: {
@ -710,16 +726,16 @@ MasterReset = function() {
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight3, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
var sconceLight4 = Entities.addEntity({
type: "Light",
position: {
@ -738,12 +754,13 @@ MasterReset = function() {
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight4, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
var sconceLight5 = Entities.addEntity({
@ -764,12 +781,13 @@ MasterReset = function() {
red: 217,
green: 146,
blue: 24
}
});
setEntityCustomData(resetKey, sconceLight5, {
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
type: "Garage Light",
type: "Garage Light"
}
})
});
}
@ -803,7 +821,12 @@ MasterReset = function() {
z: 0
},
shapeType: "box",
collisionsWillMove: true
collisionsWillMove: true,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
};
var dice1 = Entities.addEntity(diceProps);
@ -815,13 +838,6 @@ MasterReset = function() {
var dice2 = Entities.addEntity(diceProps);
setEntityCustomData(resetKey, dice1, {
resetMe: true
});
setEntityCustomData(resetKey, dice2, {
resetMe: true
});
}
@ -855,17 +871,18 @@ MasterReset = function() {
linearDamping: 1,
angularDamping: 10,
mass: 10,
});
setEntityCustomData(resetKey, gate1, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, gate1, {
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbable: false
}
})
});
var rotation2 = Quat.fromPitchYawRollDegrees(0, -16, 0);
var gate2 = Entities.addEntity({
name: 'Front Door Fence',
@ -892,14 +909,14 @@ MasterReset = function() {
linearDamping: 1,
angularDamping: 10,
mass: 10,
});
setEntityCustomData(resetKey, gate2, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, gate2, {
grabbable: false
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbable: true
}
})
});
}
@ -933,10 +950,11 @@ MasterReset = function() {
z: 0.47
},
collisionsWillMove: true,
});
setEntityCustomData(resetKey, pingPongGun, {
resetMe: true
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
}
@ -967,15 +985,15 @@ MasterReset = function() {
y: 3.99,
z: 3.79
},
compoundShapeURL: hoopCollisionHullURL
});
setEntityCustomData(resetKey, hoop, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, hoop, {
compoundShapeURL: hoopCollisionHullURL,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbaleKey: {
grabbable: false
}
})
});
}
@ -1005,12 +1023,15 @@ MasterReset = function() {
//Look into why bubble wand is going through table when gravity is enabled
// gravity: {x: 0, y: -3.5, z: 0},
// velocity: {x: 0, y: -0.01, z:0},
script: wandScriptURL
script: wandScriptURL,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createBasketBall(position) {
@ -1041,12 +1062,14 @@ MasterReset = function() {
y: -0.01,
z: 0
},
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav"
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createDoll(position) {
@ -1076,12 +1099,14 @@ MasterReset = function() {
y: -0.1,
z: 0
},
collisionsWillMove: true
collisionsWillMove: true,
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
function createSprayCan(position) {
@ -1110,11 +1135,12 @@ MasterReset = function() {
x: 0,
y: -1,
z: 0
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
});
setEntityCustomData(resetKey, entity, {
resetMe: true
})
});
}
@ -1144,16 +1170,15 @@ MasterReset = function() {
y: 0,
z: 0
},
linearDamping: 0.4
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, entity, {
grabbable: false
linearDamping: 0.4,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbableKey: {
grabbale: false
}
})
});
}
@ -1188,16 +1213,17 @@ MasterReset = function() {
y: 0,
z: 0
},
linearDamping: 0.2
});
setEntityCustomData(resetKey, entity, {
resetMe: true
});
setEntityCustomData(GRABBABLE_DATA_KEY, entity, {
linearDamping: 0.2,
userData: JSON.stringify({
resetMe: {
resetMe: true,
},
grabbaleKey: {
grabbable: false
}
})
});
}
function createBlocks(position) {
@ -1241,7 +1267,7 @@ MasterReset = function() {
y: 0.05,
z: 0.25
}
}, ];
},];
var modelURL, entity;
for (i = 0; i < blockTypes.length; i++) {
@ -1269,13 +1295,14 @@ MasterReset = function() {
x: 0,
y: -0.01,
z: 0
},
userData: JSON.stringify({
resetMe: {
resetMe: true,
}
})
});
//customKey, id, data
setEntityCustomData(resetKey, entity, {
resetMe: true
});
}
}
}