Initial version of the new crafting table
This commit is contained in:
@@ -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: ->
|
||||
|
||||
Reference in New Issue
Block a user