content/hifi-content/robin/bugFixes/injectorServerTest/injector.js
2022-02-14 02:04:11 +01:00

57 lines
No EOL
1.3 KiB
JavaScript

(function () {
var injectorOptions;
var injector;
var entityID;
print("Hello I'm here");
var InjectorServerTest = function () {
};
InjectorServerTest.prototype = {
remotelyCallable: [
"test"
],
preload: function (id) {
entityID = id;
print("Hello preload");
var position = Entities.getEntityProperties(entityID, "position").position;
injectorOptions = {
position: position,
loop: true,
// localOnly: true,
volume: 1.0
};
var sound = SoundCache.getSound("http://xiph.org/~xiphmont/demo/1kHz-0-dither.wav");
Script.setTimeout(function() {
injector = Audio.playSound(
sound,
injectorOptions
);
}, 100);
},
test: function () {
print("Hello test");
injectorOptions.volume = Math.random();
injector.setOptions(injectorOptions);
},
unload: function () {
print("Hello unload");
injector.stop();
}
};
return new InjectorServerTest();
});