Allow recipe comp. to show I/O inventories
This commit is contained in:
@@ -6,9 +6,13 @@
|
||||
//-
|
||||
|
||||
.view__crafting_table
|
||||
.input
|
||||
.input_inventory
|
||||
.view__inventory
|
||||
.input_grid
|
||||
.view__crafting_grid
|
||||
.tool
|
||||
.output
|
||||
.output_slot
|
||||
.view__slot
|
||||
.multiplier
|
||||
.output_inventory
|
||||
.view__inventory
|
||||
|
||||
@@ -8,8 +8,15 @@
|
||||
.view__crafting_table {
|
||||
display: flex;
|
||||
|
||||
.input {
|
||||
flex: 0 0 auto;
|
||||
.input_inventory {
|
||||
flex: 1 1 100%;
|
||||
|
||||
display: flex;
|
||||
margin-right: $size-margin-large;
|
||||
}
|
||||
|
||||
.input_grid {
|
||||
flex: 1 1 100%;
|
||||
|
||||
align-items : center;
|
||||
display : flex;
|
||||
@@ -27,9 +34,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
.output {
|
||||
flex: 1 1 100%;
|
||||
margin-left: $size-margin-medium;
|
||||
.output_slot {
|
||||
flex: 0 0 auto;
|
||||
margin-left: $size-margin-large;
|
||||
|
||||
display : flex;
|
||||
flex-direction : column;
|
||||
@@ -46,4 +53,10 @@
|
||||
margin-top : $size-margin-medium;
|
||||
}
|
||||
}
|
||||
|
||||
.output_inventory {
|
||||
flex: 1 1 100%;
|
||||
display: flex;
|
||||
margin-left: $size-margin-large;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
BaseController = require "../../../base_controller"
|
||||
CraftingGridController = require "../../crafting_grid/crafting_grid_controller"
|
||||
InventoryController = require "../../inventory/inventory_controller"
|
||||
ItemDisplay = require "../../../../models/site/item_display"
|
||||
RecipeDisplay = require "../../../../models/site/recipe_display"
|
||||
SlotController = require "../../slot/slot_controller"
|
||||
@@ -30,15 +31,21 @@ module.exports = class CraftingTableController extends BaseController
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onDidRender: ->
|
||||
options = modPack:@_modPack, imageLoader:@_imageLoader, router:@_router
|
||||
@_gridController = @addChild CraftingGridController, ".view__crafting_grid", options
|
||||
@_outputSlotController = @addChild SlotController, ".output .view__slot", options
|
||||
options = editable:false, modPack:@_modPack, imageLoader:@_imageLoader, router:@_router
|
||||
|
||||
@$multiplier = @$(".multiplier")
|
||||
@$outputImg = @$(".output img")
|
||||
@$outputLink = @$(".output a")
|
||||
@$outputQuantity = @$(".quantity")
|
||||
@$toolContainer = @$(".tool")
|
||||
@_inputController = @addChild InventoryController, ".input_inventory .view__inventory", options
|
||||
@_gridController = @addChild CraftingGridController, ".input_grid .view__crafting_grid", options
|
||||
@_outputSlotController = @addChild SlotController, ".output_slot .view__slot", options
|
||||
@_outputController = @addChild InventoryController, ".output_inventory .view__inventory", options
|
||||
|
||||
@$inputInventorySection = @$(".input_inventory")
|
||||
@$multiplier = @$(".multiplier")
|
||||
@$outputImg = @$(".output.slot img")
|
||||
@$outputInventorySection = @$(".output_inventory")
|
||||
@$outputLink = @$(".output.slot a")
|
||||
@$outputQuantity = @$(".quantity")
|
||||
@$outputSlotSection = @$(".output_slot")
|
||||
@$toolContainer = @$(".tool")
|
||||
super
|
||||
|
||||
onWillChangeModel: (oldModel, newModel)->
|
||||
@@ -47,10 +54,13 @@ module.exports = class CraftingTableController extends BaseController
|
||||
return super oldModel, newModel
|
||||
|
||||
refresh: ->
|
||||
@_gridController.model = @model.recipe
|
||||
@_inputController.model = @model?.getInventory()
|
||||
@_gridController.model = @model?.recipe
|
||||
@_outputSlotController.model = @model?.recipe.output
|
||||
@_outputController.model = @model?.getOutputInventory()
|
||||
|
||||
@_refreshMultiplier()
|
||||
@_refreshSections()
|
||||
@_refreshTools()
|
||||
super
|
||||
|
||||
@@ -68,6 +78,11 @@ module.exports = class CraftingTableController extends BaseController
|
||||
else
|
||||
@$multiplier.html ""
|
||||
|
||||
_refreshSections: ->
|
||||
@$inputInventorySection.css display:(if @model.showInputInventory then "" else "none")
|
||||
@$outputInventorySection.css display:(if @model.showOutputInventory then "" else "none")
|
||||
@$outputSlotSection.css display:(if @model.showOutputSlot then "" else "none")
|
||||
|
||||
_refreshTools: ->
|
||||
@$toolContainer.empty()
|
||||
return unless @model?
|
||||
|
||||
Reference in New Issue
Block a user