From efbd66a9b10f4da30d2dfbb44ea475d96c965b34 Mon Sep 17 00:00:00 2001 From: Cat Sync Date: Wed, 20 Jan 2016 11:48:09 -0500 Subject: [PATCH 1/2] use thang.labelStyle to configure Labels This allows level creators to configure the type of dialogue box used when a thang says a message. --- app/lib/surface/Label.coffee | 2 +- app/lib/surface/Lank.coffee | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/lib/surface/Label.coffee b/app/lib/surface/Label.coffee index 1f134ef2b..e4b6f1f2d 100644 --- a/app/lib/surface/Label.coffee +++ b/app/lib/surface/Label.coffee @@ -15,7 +15,7 @@ module.exports = class Label extends CocoClass @sprite = options.sprite @camera = options.camera @layer = options.layer - @style = options.style ? Label.STYLE_SAY + @style = options.style ? (@sprite?.thang?.labelStyle || Label.STYLE_SAY) console.error @toString(), 'needs a sprite.' unless @sprite console.error @toString(), 'needs a camera.' unless @camera console.error @toString(), 'needs a layer.' unless @layer diff --git a/app/lib/surface/Lank.coffee b/app/lib/surface/Lank.coffee index a606054e1..a116f3fa2 100644 --- a/app/lib/surface/Lank.coffee +++ b/app/lib/surface/Lank.coffee @@ -684,7 +684,10 @@ module.exports = Lank = class Lank extends CocoClass return unless @thang blurb = if @thang.health <= 0 then null else @thang.sayMessage # Dead men tell no tales blurb = null if blurb in ['For Thoktar!', 'Bones!', 'Behead!', 'Destroy!', 'Die, humans!'] # Let's just hear, not see, these ones. - labelStyle = if /Hero Placeholder/.test(@thang.id) then Label.STYLE_DIALOGUE else Label.STYLE_SAY + if /Hero Placeholder/.test(@thang.id) + labelStyle = Label.STYLE_DIALOGUE + else + labelStyle = @thang.labelStyle ? Label.STYLE_SAY @addLabel 'say', labelStyle if blurb if @labels.say?.setText blurb @notifySpeechUpdated blurb: blurb From 622c3d46de00f253e70baf28619ca45071fbfb93 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 20 Jan 2016 09:34:25 -0800 Subject: [PATCH 2/2] More investigation for baffling _.pluck bug --- server/queues/scoring/scoringUtils.coffee | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/queues/scoring/scoringUtils.coffee b/server/queues/scoring/scoringUtils.coffee index 5695e60a7..1324feafd 100644 --- a/server/queues/scoring/scoringUtils.coffee +++ b/server/queues/scoring/scoringUtils.coffee @@ -44,13 +44,10 @@ module.exports.calculateSessionScores = (callback) -> sessionIDs = _.map @clientResponseObject.sessions, 'sessionID' async.map sessionIDs, retrieveOldSessionData.bind(@), (err, oldScores) => if err? then return callback err, {error: 'There was an error retrieving the old scores'} - try - oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject @clientResponseObject, oldScores - newScoreArray = updatePlayerSkills oldScoreArray - createSessionScoreUpdate.call @, scoreObject for scoreObject in newScoreArray - callback err, newScoreArray - catch e - callback e + oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject @clientResponseObject, oldScores + newScoreArray = updatePlayerSkills oldScoreArray + createSessionScoreUpdate.call @, scoreObject for scoreObject in newScoreArray + callback null, newScoreArray retrieveOldSessionData = (sessionID, callback) -> formatOldScoreObject = (session) =>