From 356d1b55ed65f449fe110bd927498ce1dd3f76c4 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Tue, 25 Feb 2014 11:59:23 -0800 Subject: [PATCH] Added a property to prevent scripts from running after certain other scripts have run. --- app/lib/surface/SpriteBoss.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index 9adec0f61..5e9df2af3 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -184,6 +184,11 @@ module.exports = class SpriteBoss extends CocoClass sprite.hasMoved = false @removeSprite sprite if missing @cache true if updateCache and @cached + + # mainly for handling selecting thangs from session when the thang is not always in existence + if @willSelectThang and @sprites[@willSelectThang[0]] + @selectThang @willSelectThang... + @willSelectThang = null cache: (update=false) -> return if @cached and not update @@ -241,6 +246,7 @@ module.exports = class SpriteBoss extends CocoClass @selectSprite e if e.onBackground selectThang: (thangID, spellName=null) -> + return @willSelectThang = [thangID, spellName] unless @sprites[thangID] @selectSprite null, @sprites[thangID], spellName selectSprite: (e, sprite=null, spellName=null) ->