mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
code cleanup
This commit is contained in:
parent
b0cb4b7199
commit
6c6ea3f0a7
2 changed files with 10 additions and 14 deletions
|
@ -30,18 +30,18 @@ function findCells() {
|
|||
var results = Entities.findEntities(basePosition, 60000);
|
||||
|
||||
if (results.length === 0) {
|
||||
// print('no entities found')
|
||||
// print('no entities found')
|
||||
return;
|
||||
}
|
||||
|
||||
results.forEach(function(v) {
|
||||
var name = Entities.getEntityProperties(v, 'name').name;
|
||||
// print('name is:: ' + name)
|
||||
// print('name is:: ' + name)
|
||||
if (name === 'Cell') {
|
||||
// print('found a cell!!' + v)
|
||||
// print('found a cell!!' + v)
|
||||
Script.setTimeout(function() {
|
||||
moveCell(v);
|
||||
}, Math.random() * THROTTLE_RATE)
|
||||
}, Math.random() * THROTTLE_RATE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ var minAngularVelocity = 0.01;
|
|||
var maxAngularVelocity = 0.03;
|
||||
|
||||
function moveCell(entityId) {
|
||||
// print('moving a cell! ' + entityId)
|
||||
// print('moving a cell! ' + entityId)
|
||||
|
||||
var magnitudeAV = maxAngularVelocity;
|
||||
|
||||
|
@ -60,7 +60,7 @@ function moveCell(entityId) {
|
|||
y: Math.random() - 0.5,
|
||||
z: Math.random() - 0.5
|
||||
};
|
||||
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
|
||||
// print("ROT magnitude is " + magnitudeAV + " and direction is " + directionAV.x);
|
||||
Entities.editEntity(entityId, {
|
||||
angularVelocity: Vec3.multiply(magnitudeAV, Vec3.normalize(directionAV))
|
||||
});
|
||||
|
@ -84,7 +84,7 @@ function update(deltaTime) {
|
|||
if (THROTTLE === true) {
|
||||
sinceLastUpdate = sinceLastUpdate + deltaTime * 1000;
|
||||
if (sinceLastUpdate > THROTTLE_RATE) {
|
||||
// print('SHOULD FIND CELLS!!!')
|
||||
// print('SHOULD FIND CELLS!!!')
|
||||
sinceLastUpdate = 0;
|
||||
findCells();
|
||||
} else {
|
||||
|
|
|
@ -30,18 +30,17 @@ function findVesicles() {
|
|||
var results = Entities.findEntities(basePosition, 60000);
|
||||
|
||||
if (results.length === 0) {
|
||||
print('no entities found')
|
||||
// print('no entities found');
|
||||
return;
|
||||
}
|
||||
|
||||
results.forEach(function(v) {
|
||||
var name = Entities.getEntityProperties(v, 'name').name;
|
||||
print('name is:: ' + name)
|
||||
if (name === 'vesicle') {
|
||||
// print('found a vesicle!!' + v)
|
||||
//print('found a vesicle!!' + v)
|
||||
Script.setTimeout(function() {
|
||||
moveVesicle(v);
|
||||
}, Math.random() * THROTTLE_RATE)
|
||||
}, Math.random() * THROTTLE_RATE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -78,7 +77,6 @@ function moveVesicle(entityId) {
|
|||
}
|
||||
|
||||
function update(deltaTime) {
|
||||
// print('deltaTime',deltaTime)
|
||||
if (!initialized) {
|
||||
print("checking for servers...");
|
||||
if (Entities.serversExist() && Entities.canRez()) {
|
||||
|
@ -93,11 +91,9 @@ function update(deltaTime) {
|
|||
if (THROTTLE === true) {
|
||||
sinceLastUpdate = sinceLastUpdate + deltaTime * 1000;
|
||||
if (sinceLastUpdate > THROTTLE_RATE) {
|
||||
// print('SHOULD FIND VESICLES!!!')
|
||||
sinceLastUpdate = 0;
|
||||
findVesicles();
|
||||
} else {
|
||||
// print('returning in update ' + sinceLastUpdate)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue