mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Add tealight.js entity server script
This commit is contained in:
parent
9605379265
commit
f88433b7bb
1 changed files with 21 additions and 0 deletions
21
unpublishedScripts/marketplace/teaLight/teaLight.js
Normal file
21
unpublishedScripts/marketplace/teaLight/teaLight.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
var MINIMUM_LIGHT_INTENSITY = 100.0;
|
||||
var MAXIMUM_LIGHT_INTENSITY = 125.0;
|
||||
|
||||
// Return a random number between `low` (inclusive) and `high` (exclusive)
|
||||
function randFloat(low, high) {
|
||||
return low + Math.random() * (high - low);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.preload = function(entityID) {
|
||||
self.intervalID = Script.setInterval(function() {
|
||||
Entities.editEntity(entityID, {
|
||||
intensity: randFloat(MINIMUM_LIGHT_INTENSITY, MAXIMUM_LIGHT_INTENSITY)
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
this.unload = function() {
|
||||
Script.clearInterval(self.intervalID);
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue