Add back the "include tools" option

* Rewrite the crafting algorithm to recursively find all the steps
  involved and then resolve how many times each needs to be run.
* Update the base controller to debounce calls to refresh
* Fix a few erroneous recipes for IC2-Classic
This commit is contained in:
Andrew Miner
2015-01-11 16:01:51 -08:00
parent 16f17f62a1
commit a784f275ff
8 changed files with 125 additions and 98 deletions
@@ -23,6 +23,8 @@ module.exports = class BaseController extends Backbone.View
@_loadTemplate options.templateName
super options
@_tryRefresh = _.debounce @_tryRefresh, 100
# Public Methods ###############################################################################
addChild: (Controller, atSelector, options={})->
@@ -22,6 +22,11 @@ module.exports = class ItemPageController extends BaseController
options.templateName = 'item_page'
super options
# Event Methods ################################################################################
onToolsBoxToggled: ->
@model.plan.includingTools = @$('.includeTools:checked').length isnt 0
# BaseController Overrides #####################################################################
onDidRender: ->
@@ -54,4 +59,19 @@ module.exports = class ItemPageController extends BaseController
modPack: @model.modPack
@modPackController = @addChild ModPackController, '.view__mod_pack', model:@model.modPack
@$('.want .toolbar').append '<label><input class="includeTools" type="checkbox"> include tools</label'
@$includeToolsBox = @$('.includeTools')
super
refresh: ->
if @model.plan.includingTools
@$includeToolsBox.attr 'checked', 'checked'
else
@$includeToolsBox.removeAttr 'checked'
# Backbone.View Overrides ######################################################################
events:
'change .includeTools': 'onToolsBoxToggled'