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
+9 -4
View File
@@ -5,15 +5,17 @@ Copyright (c) 2014-2015 by Redwood Labs
All rights reserved.
###
BaseModel = require './base_model'
Inventory = require './inventory'
########################################################################################################################
module.exports = class CraftingPlan
module.exports = class CraftingPlan extends BaseModel
constructor: (@modPack, includingTools)->
if not @modPack then throw new Error 'modPack is required'
@includingTools = if includingTools then true else false
constructor: (attributes={}, options={})->
if not attributes.modPack then throw new Error 'modPack is required'
attributes.includingTools ?= false
super attributes, options
@have = new Inventory
@want = new Inventory
@@ -35,6 +37,7 @@ module.exports = class CraftingPlan
@need.clear()
@result.clear()
@trigger 'change', this
return this
craft: ->
@@ -55,6 +58,8 @@ module.exports = class CraftingPlan
@need.addInventory @_need
@steps.reverse()
@trigger 'change', this
# Object Overrides #############################################################################
toString: ->