Fix issues in several tutorial scripts

This commit is contained in:
Ryan Huffman 2016-10-13 16:52:43 -07:00
parent e58cd53fe5
commit 97fbdc7c20
4 changed files with 24 additions and 7 deletions

View file

@ -11,7 +11,7 @@
(function() {
Script.include('utils.js');
var DEBUG = false;
var DEBUG = true;
function debug() {
if (DEBUG) {
var args = Array.prototype.slice.call(arguments);
@ -109,7 +109,7 @@
Script.setTimeout(function() {
debug("Setting fuse to inactive");
active = false;
}, 10000);
}, 14000);
},
preload: function(entityID) {
debug("Preload");

View file

@ -9,10 +9,10 @@
//
(function() {
var DEBUG = false;
var DEBUG = true;
function debug() {
if (DEBUG) {
print.apply(self, arguments);
print.apply(this, arguments);
}
}

View file

@ -20,7 +20,7 @@
print("TutorialStartZone | Parent ID is: ", parentID);
if (parentID) {
print("TutorialStartZone | Sending start");
Entities.callEntityMethod(parentID, 'start');
Entities.callEntityMethod(parentID, 'onEnteredStartZone');
} else {
print("TutorialStartZone | ERROR: No parent id found on tutorial start zone");
}
@ -38,6 +38,12 @@
if (this.sendStartIntervalID) {
Script.clearInterval(this.sendStartIntervalID);
}
var parentID = Entities.getEntityProperties(this.entityID, 'parentID').parentID;
print("TutorialStartZone | Parent ID is: ", parentID);
if (parentID) {
print("TutorialStartZone | Sending onLeftStartZone");
Entities.callEntityMethod(parentID, 'on');
}
}
};

View file

@ -59,11 +59,13 @@ if (!Function.prototype.bind) {
print("TutorialZone | Preload");
this.entityID = entityID;
},
start: function() {
print("TutorialZone | Got start");
onEnteredStartZone: function() {
print("TutorialZone | Got onEnteredStartZone");
var self = this;
if (!this.token) {
print("TutorialZone | Creating token");
// The start zone has been entered, hide the overlays immediately
Menu.setIsOptionChecked("Overlays", false);
this.token = new OwnershipToken(Math.random() * 100000, this.entityID, {
onGainedOwnership: function(token) {
print("TutorialZone | GOT OWNERSHIP");
@ -91,6 +93,15 @@ if (!Function.prototype.bind) {
});
}
},
onLeftStartZone: function() {
print("TutorialZone | Got onLeftStartZone");
// If the start zone was exited, and the tutorial hasn't started, go ahead and
// re-enable the HUD/Overlays
if (!self.tutorialManager) {
Menu.setIsOptionChecked("Overlays", true);
}
},
enterEntity: function() {
print("TutorialZone | ENTERED THE TUTORIAL AREA");