From 9d82f9830cf83536e06346bc7157228b142bbc96 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sun, 22 Oct 2017 13:13:06 +0200 Subject: [PATCH] failsafe scene instance creation, logs for systems --- src/game-lib-d3-scene.js | 12 ++++++++++-- src/game-lib-system-0.js | 3 +++ src/game-lib-system-storage.js | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/game-lib-d3-scene.js b/src/game-lib-d3-scene.js index 36a587e..a27f9d0 100644 --- a/src/game-lib-d3-scene.js +++ b/src/game-lib-d3-scene.js @@ -157,13 +157,21 @@ GameLib.D3.Scene.prototype.createInstance = function() { this.meshes.map( function(mesh) { - instance.add(mesh.instance); + if (mesh && mesh.instance) { + instance.add(mesh.instance); + } else { + console.warn('invalid mesh at point of scene create instance'); + } }.bind(this) ); this.lights.map( function(light) { - instance.add(light.instance); + if (light && light.instance) { + instance.add(light.instance); + } else { + console.warn('invalid light at point of scene create instance'); + } } ); diff --git a/src/game-lib-system-0.js b/src/game-lib-system-0.js index d8721e0..0d73be5 100644 --- a/src/game-lib-system-0.js +++ b/src/game-lib-system-0.js @@ -62,6 +62,7 @@ GameLib.System.prototype.start = function() { this.started = true; + console.log('starting ' + this.name); // if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) { // // this.pathFollowingObjects = GameLib.EntityManager.Instance.query([GameLib.D3.PathFollowing]); @@ -134,6 +135,8 @@ GameLib.System.prototype.stop = function() { this.started = false; + console.log('stopping ' + this.name); + // // if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) { // // this.pathFollowingObjects = []; diff --git a/src/game-lib-system-storage.js b/src/game-lib-system-storage.js index 006a5e3..93d8721 100644 --- a/src/game-lib-system-storage.js +++ b/src/game-lib-system-storage.js @@ -470,7 +470,7 @@ GameLib.System.Storage.prototype.loadComponent = function(apiUrl, toProcess, inc if (!runtimeComponent) { if (clientErrorCallback) { - clientErrorCallback('Could not create a runtime component: ' + component.name); + clientErrorCallback({result : 'failure', message : 'Could not create a runtime component: ' + component.name}); } //throw new Error('Could not create a runtime component: ' + component.name); }