mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fixed cosmetic GoalManager destruction error.
This commit is contained in:
parent
248cec1e6e
commit
022722a19f
2 changed files with 4 additions and 2 deletions
|
@ -9,7 +9,7 @@ module.exports = class CocoClass
|
|||
@nicksUsed: {}
|
||||
@remainingNicks: []
|
||||
@nextNick: ->
|
||||
return "CocoClass " + classCount unless @nicks.length
|
||||
return (@name or "CocoClass") + " " + classCount unless @nicks.length
|
||||
@remainingNicks = if @remainingNicks.length then @remainingNicks else @nicks.slice()
|
||||
baseNick = @remainingNicks.splice(Math.floor(Math.random() * @remainingNicks.length), 1)[0]
|
||||
i = 0
|
||||
|
@ -37,7 +37,7 @@ module.exports = class CocoClass
|
|||
destroy: ->
|
||||
# teardown subscriptions, prevent new ones
|
||||
@stopListening?()
|
||||
@off()
|
||||
@off?()
|
||||
@unsubscribeAll()
|
||||
@stopListeningToShortcuts()
|
||||
@constructor.nicksUsed[@nick] = false
|
||||
|
@ -65,6 +65,7 @@ module.exports = class CocoClass
|
|||
Backbone.Mediator.subscribe(channel, func, @)
|
||||
|
||||
unsubscribeAll: ->
|
||||
return unless Backbone?.Mediator?
|
||||
for channel, func of @subscriptions
|
||||
func = utils.normalizeFunc(func, @)
|
||||
Backbone.Mediator.unsubscribe(channel, func, @)
|
||||
|
|
|
@ -14,6 +14,7 @@ module.exports = class GoalManager extends CocoClass
|
|||
# If you want weird goals or hybrid goals, make a custom goal.
|
||||
|
||||
nextGoalID: 0
|
||||
nicks: ["GoalManager"]
|
||||
|
||||
constructor: (@world, @initialGoals, @team) ->
|
||||
super()
|
||||
|
|
Loading…
Reference in a new issue