From 97fbdc7c2089ea9df4dd40d048076ba8f27bb327 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Oct 2016 16:52:43 -0700 Subject: [PATCH] Fix issues in several tutorial scripts --- tutorial/fuse.js | 4 ++-- tutorial/spinner.js | 4 ++-- tutorial/tutorialStartZone.js | 8 +++++++- tutorial/tutorialZone.js | 15 +++++++++++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tutorial/fuse.js b/tutorial/fuse.js index 30afd49620..73a3a697bd 100644 --- a/tutorial/fuse.js +++ b/tutorial/fuse.js @@ -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"); diff --git a/tutorial/spinner.js b/tutorial/spinner.js index b27022fce2..2edbb43700 100644 --- a/tutorial/spinner.js +++ b/tutorial/spinner.js @@ -9,10 +9,10 @@ // (function() { - var DEBUG = false; + var DEBUG = true; function debug() { if (DEBUG) { - print.apply(self, arguments); + print.apply(this, arguments); } } diff --git a/tutorial/tutorialStartZone.js b/tutorial/tutorialStartZone.js index 5cff1a4e99..81d4892919 100644 --- a/tutorial/tutorialStartZone.js +++ b/tutorial/tutorialStartZone.js @@ -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'); + } } }; diff --git a/tutorial/tutorialZone.js b/tutorial/tutorialZone.js index db7306a529..6c78d678b4 100644 --- a/tutorial/tutorialZone.js +++ b/tutorial/tutorialZone.js @@ -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");