cleanup comments, semicolons

This commit is contained in:
James B. Pollack 2016-05-05 10:37:32 -07:00
parent d98732d5a1
commit 6d3a3b0cc5
2 changed files with 27 additions and 29 deletions

View file

@ -25,14 +25,15 @@
x: 1.8838, x: 1.8838,
y: 1.7865, y: 1.7865,
z: 0.2955 z: 0.2955
} };
var ROBOT_DIMENSIONS = { var ROBOT_DIMENSIONS = {
//robot //robot
x: 1.4439, x: 1.4439,
y: 0.6224, y: 0.6224,
z: 0.4998 z: 0.4998
} };
var WILL_DIMENSIONS = { var WILL_DIMENSIONS = {
x: 1.6326, x: 1.6326,
y: 1.6764, y: 1.6764,
@ -51,14 +52,14 @@
x: 1.8722, x: 1.8722,
y: 1.8197, y: 1.8197,
z: 0.3666 z: 0.3666
} };
var _this; var _this;
function Transformer() { function Transformer() {
_this = this; _this = this;
return this; return this;
} };
Transformer.prototype = { Transformer.prototype = {
locked: false, locked: false,
@ -74,11 +75,11 @@
var otherProps = Entities.getEntityProperties(otherID); var otherProps = Entities.getEntityProperties(otherID);
if (otherProps.name === "hifi-home-dressing-room-transformer-collider" && _this.locked === false) { if (otherProps.name === "hifi-home-dressing-room-transformer-collider" && _this.locked === false) {
print('UNLOCKED TRANSFORMER COLLIDED WITH BASE!! THE AVATAR WHO SIMULATED THIS COLLISION IS:: ' + MyAvatar.sessionUUID);
_this.locked = true; _this.locked = true;
_this.findRotatorBlock(); _this.findRotatorBlock();
} else { } else {
var transformerProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]); var transformerProps = Entities.getEntityProperties(_this.entityID, ["rotation", "position"]);
var eulerRotation = Quat.safeEulerAngles(transformerProps.rotation); var eulerRotation = Quat.safeEulerAngles(transformerProps.rotation);
eulerRotation.x = 0; eulerRotation.x = 0;
eulerRotation.z = 0; eulerRotation.z = 0;
@ -98,14 +99,15 @@
z: 0 z: 0
} }
}); });
return; return;
} }
}, },
findRotatorBlock: function() { findRotatorBlock: function() {
print('transformer should find rotator block')
var myProps = Entities.getEntityProperties(_this.entityID); var myProps = Entities.getEntityProperties(_this.entityID);
var results = Entities.findEntities(myProps.position, 10); var results = Entities.findEntities(myProps.position, 10);
results.forEach(function(result) { results.forEach(function(result) {
var resultProps = Entities.getEntityProperties(result); var resultProps = Entities.getEntityProperties(result);
if (resultProps.name === "hifi-home-dressing-room-rotator-block") { if (resultProps.name === "hifi-home-dressing-room-rotator-block") {
@ -117,10 +119,10 @@
}, },
removeCurrentBigVersion: function(rotatorBlock) { removeCurrentBigVersion: function(rotatorBlock) {
print('transformer should remove big version')
var blacklistKey = 'Hifi-Hand-RayPick-Blacklist'; var blacklistKey = 'Hifi-Hand-RayPick-Blacklist';
var myProps = Entities.getEntityProperties(_this.entityID); var myProps = Entities.getEntityProperties(_this.entityID);
var results = Entities.findEntities(myProps.position, 10); var results = Entities.findEntities(myProps.position, 10);
results.forEach(function(result) { results.forEach(function(result) {
var resultProps = Entities.getEntityProperties(result); var resultProps = Entities.getEntityProperties(result);
if (resultProps.name === "hifi-home-dressing-room-big-transformer") { if (resultProps.name === "hifi-home-dressing-room-big-transformer") {
@ -134,36 +136,35 @@
return; return;
} }
}); });
_this.createBigVersion(); _this.createBigVersion();
}, },
createBigVersion: function() { createBigVersion: function() {
var smallProps = Entities.getEntityProperties(_this.entityID); var smallProps = Entities.getEntityProperties(_this.entityID);
print('transformer should create big version!!' + smallProps.modelURL);
print('transformer has rotatorBlock??' + _this.rotatorBlock);
var rotatorProps = Entities.getEntityProperties(_this.rotatorBlock); var rotatorProps = Entities.getEntityProperties(_this.rotatorBlock);
var dimensions; var dimensions;
if (smallProps.modelURL.indexOf('will') > -1) { if (smallProps.modelURL.indexOf('will') > -1) {
print('TRANSFORMER IS WILL') // print('TRANSFORMER IS WILL');
dimensions = WILL_DIMENSIONS; dimensions = WILL_DIMENSIONS;
} else if (smallProps.modelURL.indexOf('being_of_light') > -1) { } else if (smallProps.modelURL.indexOf('being_of_light') > -1) {
print('TRANSFORMER IS BEING OF LIGHT') // print('TRANSFORMER IS BEING OF LIGHT');
dimensions = BEING_OF_LIGHT_DIMENSIONS; dimensions = BEING_OF_LIGHT_DIMENSIONS;
} else if (smallProps.modelURL.indexOf('stylized_female') > -1) { } else if (smallProps.modelURL.indexOf('stylized_female') > -1) {
print('TRANSFORMER IS ARTEMIS') // print('TRANSFORMER IS ARTEMIS');
dimensions = STYLIZED_FEMALE_DIMENSIONS; dimensions = STYLIZED_FEMALE_DIMENSIONS;
} else if (smallProps.modelURL.indexOf('simple_robot') > -1) { } else if (smallProps.modelURL.indexOf('simple_robot') > -1) {
print('TRANSFORMER IS A ROBOT') // print('TRANSFORMER IS A ROBOT');
dimensions = ROBOT_DIMENSIONS; dimensions = ROBOT_DIMENSIONS;
} else if (smallProps.modelURL.indexOf('priscilla') > -1) { } else if (smallProps.modelURL.indexOf('priscilla') > -1) {
print('TRANSFORMER IS PRISCILLA') // print('TRANSFORMER IS PRISCILLA');
dimensions = PRISCILLA_DIMENSIONS; dimensions = PRISCILLA_DIMENSIONS;
} else if (smallProps.modelURL.indexOf('matthew') > -1) { } else if (smallProps.modelURL.indexOf('matthew') > -1) {
print('TRANSFORMER IS MATTHEW') // print('TRANSFORMER IS MATTHEW');
dimensions = MATTHEW_DIMENSIONS; dimensions = MATTHEW_DIMENSIONS;
} else { } else {
print('TRANSFORMER IS SOME OTHER'); // print('TRANSFORMER IS SOME OTHER');
dimensions = smallProps.naturalDimensions; dimensions = smallProps.naturalDimensions;
} }
@ -183,14 +184,13 @@
'reset': true 'reset': true
} }
}), }),
} };
if (bigVersionProps.modelURL.indexOf('simple_robot') > -1) { if (bigVersionProps.modelURL.indexOf('simple_robot') > -1) {
bigVersionProps.position.y += 0.5; bigVersionProps.position.y += 0.5;
} }
var bigVersion = Entities.addEntity(bigVersionProps); var bigVersion = Entities.addEntity(bigVersionProps);
print('transformer created big version: ' + bigVersion);
var blacklistKey = 'Hifi-Hand-RayPick-Blacklist'; var blacklistKey = 'Hifi-Hand-RayPick-Blacklist';
Messages.sendMessage(blacklistKey, JSON.stringify({ Messages.sendMessage(blacklistKey, JSON.stringify({
@ -202,12 +202,10 @@
}, },
putTransformerOnRotatorBlock: function(blockPosition) { putTransformerOnRotatorBlock: function(blockPosition) {
print('transformer should get set on rotator block') return blockPosition;
return blockPosition
}, },
putNewVersionOnShelf: function() { putNewVersionOnShelf: function() {
print('transformer should out a new version of itself on the shelf')
var littleVersionProps = Entities.getEntityProperties(_this.entityID); var littleVersionProps = Entities.getEntityProperties(_this.entityID);
delete littleVersionProps.id; delete littleVersionProps.id;
delete littleVersionProps.created; delete littleVersionProps.created;
@ -218,23 +216,24 @@
delete littleVersionProps.localPosition; delete littleVersionProps.localPosition;
delete littleVersionProps.localRotation; delete littleVersionProps.localRotation;
delete littleVersionProps.naturalPosition; delete littleVersionProps.naturalPosition;
// delete littleVersionProps.script;
littleVersionProps.gravity = { littleVersionProps.gravity = {
x: 0, x: 0,
y: -10, y: -10,
z: 0 z: 0
}; };
var userData = JSON.parse(littleVersionProps.userData); var userData = JSON.parse(littleVersionProps.userData);
var basePosition = userData["hifiHomeTransformerKey"].basePosition; var basePosition = userData["hifiHomeTransformerKey"].basePosition;
var baseRotation = userData["hifiHomeTransformerKey"].baseRotation; var baseRotation = userData["hifiHomeTransformerKey"].baseRotation;
littleVersionProps.position = basePosition; littleVersionProps.position = basePosition;
littleVersionProps.rotation = baseRotation; littleVersionProps.rotation = baseRotation;
var littleTransformer = Entities.addEntity(littleVersionProps); var littleTransformer = Entities.addEntity(littleVersionProps);
_this.removeSelf(); _this.removeSelf();
}, },
removeSelf: function() { removeSelf: function() {
print('transformer should remove itself')
var success = Entities.deleteEntity(_this.entityID); var success = Entities.deleteEntity(_this.entityID);
}, },
}; };

View file

@ -13,8 +13,9 @@ var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js');
var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-6.obj'; var AVATAR_COLLISION_HULL = 'atp:/dressingRoom/Avatar-Hull-6.obj';
var ROBOT_COLLISION_HULL = 'atp:/dressingRoom/robot_hull.obj'; var ROBOT_COLLISION_HULL = 'atp:/dressingRoom/robot_hull.obj';
TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) { TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
print('SCRIPT REF AT TRANSFORMER CREATE::' + TRANSFORMER_SCRIPT);
var transformerProps = { var transformerProps = {
name: 'hifi-home-dressing-room-little-transformer', name: 'hifi-home-dressing-room-little-transformer',
type: 'Model', type: 'Model',
@ -48,15 +49,13 @@ TransformerDoll = function(modelURL, spawnPosition, spawnRotation, dimensions) {
density: 7500, density: 7500,
dimensions: dimensions, dimensions: dimensions,
script: TRANSFORMER_SCRIPT script: TRANSFORMER_SCRIPT
} };
if (modelURL.indexOf('robot') > -1) { if (modelURL.indexOf('robot') > -1) {
print('THIS IS A ROBOT, GIVE IT A DIFFERENT SHAPE TYPE') transformerProps.compoundShapeURL = ROBOT_COLLISION_HULL;
transformerProps.compoundShapeURL =ROBOT_COLLISION_HULL;
} }
var transformer = Entities.addEntity(transformerProps);
print('CREATED TRANSFORMER' + transformer); var transformer = Entities.addEntity(transformerProps);
return this; return this;
} }