Update parser to unparse multiblocks

This commit is contained in:
Andrew Miner
2015-11-25 20:40:53 -08:00
parent aa43e97c6c
commit 23622a2c54
2 changed files with 21 additions and 0 deletions
@@ -297,10 +297,25 @@ module.exports = class ModVersionParserV1 extends CommandParserVersionBase
.line 'item: ', item.name
.indent()
.onlyIf item.isGatherable, => builder.line 'gatherable: yes'
.onlyIf item.multiblock?, =>
builder
.indent()
.call => @_unparseMultiblock builder, item.multiblock
.outdent()
.onlyIf recipes.length > 0, =>
builder.loop recipes, delimiter:'', onEach:(b, r)=> @_unparseRecipe(b, r)
.outdent()
_unparseMultiblock: (builder, multiblock)->
builder
.line 'multiblock:'
.indent()
.push "input: "
.call => @_unparseStackList builder, multiblock.input
.push ";\n"
.loop(multiblock.layers, delimiter:'', onEach:(builder, layer)=> builder.line "layer: #{layer}")
.outdent()
_unparseRecipe: (builder, recipe)->
inputStacks = recipe.input[..]
inputStacks.sort (a, b)-> Stack.compare a, b