mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 19:12:28 +02:00
Add EntityScriptServer version of the stampede test
This commit is contained in:
parent
c89d203f94
commit
02827552ae
1 changed files with 33 additions and 0 deletions
33
scripts/developer/tests/entityServerStampedeTest.js
Normal file
33
scripts/developer/tests/entityServerStampedeTest.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var NUM_ENTITIES = 100;
|
||||
var RADIUS = 2;
|
||||
var DIV = NUM_ENTITIES / Math.PI / 2;
|
||||
var PASS_SCRIPT_URL = Script.resolvePath('entityStampedeTest-entity.js');
|
||||
var FAIL_SCRIPT_URL = Script.resolvePath('entityStampedeTest-entity-fail.js');
|
||||
|
||||
var origin = Vec3.sum(MyAvatar.position, Vec3.multiply(5, Quat.getFront(MyAvatar.orientation)));
|
||||
origin.y += HMD.eyeHeight;
|
||||
|
||||
var uuids = [];
|
||||
|
||||
Script.scriptEnding.connect(function() {
|
||||
uuids.forEach(function(id) {
|
||||
Entities.deleteEntity(id);
|
||||
});
|
||||
});
|
||||
|
||||
for (var i=0; i < NUM_ENTITIES; i++) {
|
||||
var failGroup = i % 2;
|
||||
uuids.push(Entities.addEntity({
|
||||
type: 'Shape',
|
||||
shape: failGroup ? 'Sphere' : 'Icosahedron',
|
||||
name: 'SERVER-entityStampedeTest-' + i,
|
||||
lifetime: 120,
|
||||
position: Vec3.sum(origin, Vec3.multiplyQbyV(
|
||||
MyAvatar.orientation, { x: Math.sin(i / DIV) * RADIUS, y: Math.cos(i / DIV) * RADIUS, z: 0 }
|
||||
)),
|
||||
serverScripts: (failGroup ? FAIL_SCRIPT_URL : PASS_SCRIPT_URL) + Settings.getValue('cache_buster'),
|
||||
dimensions: Vec3.HALF,
|
||||
color: { red: 0, green: 0, blue: 0 },
|
||||
}, !Entities.serversExist()));
|
||||
}
|
||||
|
Loading…
Reference in a new issue