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:
@@ -22,23 +22,14 @@ module.exports = class Inventory extends BaseModel
|
||||
# Public Methods ###############################################################################
|
||||
|
||||
add: (itemSlug, quantity=1)->
|
||||
return if quantity is 0
|
||||
|
||||
stack = @_stacks[itemSlug]
|
||||
if not stack?
|
||||
stack = new Stack itemSlug:itemSlug, quantity:quantity
|
||||
@_stacks[itemSlug] = stack
|
||||
@_slugs.push itemSlug
|
||||
@_slugs.sort()
|
||||
else
|
||||
stack.quantity += quantity
|
||||
|
||||
@_add itemSlug, quantity
|
||||
@trigger Event.add, this, itemSlug, quantity
|
||||
@trigger Event.change, this
|
||||
return this
|
||||
|
||||
addInventory: (inventory)->
|
||||
inventory.each (stack)=> @add stack.itemSlug, stack.quantity
|
||||
inventory.each (stack)=> @_add stack.itemSlug, stack.quantity
|
||||
@trigger Event.change, this
|
||||
return this
|
||||
|
||||
clear: ->
|
||||
@@ -122,3 +113,17 @@ module.exports = class Inventory extends BaseModel
|
||||
|
||||
result.push '}'
|
||||
return result.join ''
|
||||
|
||||
# Private Methods ##############################################################################
|
||||
|
||||
_add: (itemSlug, quantity=1)->
|
||||
return if quantity is 0
|
||||
|
||||
stack = @_stacks[itemSlug]
|
||||
if not stack?
|
||||
stack = new Stack itemSlug:itemSlug, quantity:quantity
|
||||
@_stacks[itemSlug] = stack
|
||||
@_slugs.push itemSlug
|
||||
@_slugs.sort()
|
||||
else
|
||||
stack.quantity += quantity
|
||||
|
||||
Reference in New Issue
Block a user