Update bat.js to lazy load the pitching machine

This commit is contained in:
Ryan Huffman 2015-11-02 15:34:42 -08:00 committed by Atlante45
parent d535bb6ed8
commit bb0ce67f6b

View file

@ -1,8 +1,11 @@
(function() {
Script.include("pitching.js");
var pitchingMachine = getPitchingMachine();
Script.update.connect(function(dt) { pitchingMachine.update(dt); });
var pitchingMachine = null;
this.startNearGrab = function() {
if (!pitchingMachine) {
getPitchingMachine();
Script.update.connect(function(dt) { pitchingMachine.update(dt); });
}
print("Started near grab!");
pitchingMachine.start();
MyAvatar.shouldRenderLocally = false;