Initial version of the new crafting table

This commit is contained in:
Andrew Miner
2015-01-08 11:03:43 -08:00
parent 9f79722378
commit 9424af9d84
26 changed files with 280 additions and 228 deletions
+15 -3
View File
@@ -6,9 +6,7 @@ All rights reserved.
###
BaseModel = require './base_model'
CraftingPlan = require './crafting_plan'
{Event} = require '../constants'
Inventory = require './inventory'
CraftingGrid = require './crafting_grid'
########################################################################################################################
@@ -16,9 +14,23 @@ module.exports = class CraftingTable extends BaseModel
constructor: (attributes={}, options={})->
if not attributes.plan? then throw new Error "attributes.plan is required"
attributes.grid ?= new CraftingGrid modPack:attributes.plan.modPack
attributes.step ?= 0
super attributes, options
@plan.on 'change', => @reset()
# Public Methods ###############################################################################
reset: ->
logger.trace "CraftingTable.reset()"
@step = 0
@grid.recipe = @plan.steps[0]
@trigger 'change', this
return this
# Object Overrides #############################################################################
toString: ->