From e8da248302597dfe887b1a4eff40a2634d999b26 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Tue, 22 Apr 2014 10:39:15 -0700 Subject: [PATCH] Made the level editor not break when using units that are incomplete. --- app/lib/surface/CocoSprite.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index f09410e12..80b30ec09 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -323,7 +323,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass if not action and @thang?.actionActivated and not @stopLogging console.error "action is", action, "for", @thang?.id, "from", @currentRootAction, @thang.action, @thang.getActionName?() @stopLogging = true - @queueAction(action) if isDifferent or (@thang?.actionActivated and action.name isnt 'move') + @queueAction(action) if action and (isDifferent or (@thang?.actionActivated and action.name isnt 'move')) @updateActionDirection() determineAction: -> @@ -332,8 +332,11 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass action = thang.action if thang?.acts action ?= @currentRootAction.name if @currentRootAction? action ?= 'idle' - action = null unless @actions[action]? - return null unless action + unless @actions[action]? + @warnedFor ?= {} + console.warn 'Cannot show action', action, 'for', @thangType.get('name'), 'because it DNE' unless @warnedFor[action] + @warnedFor[action] = true + return null action = 'break' if @actions.break? and @thang?.erroredOut action = 'die' if @actions.die? and thang?.health? and thang.health <= 0 @actions[action]