Refactor ModVersion into Mod and ModVersion
* Remove V1 of the mod version parser and shift V2 up to be V1 * Add a parser for mod.cg files, and refactor the the mod-version.cg files to push the appropriate content up to the mod.cg * Remove the concept of "silent" from BaseModel along with logging each event as they are fired (which is what really prompted the need for it in the first place) * Move use of the Storage class to be completely the province of the controllers most closely related to models affected * Convert the ModVersionController to the ModController and have it take on responsibility for choosing the mod version * Update BaseModel to support simple accessors for the current state * Update CraftingPlan to be able to remove uncraftable items * Implement the Mod model
This commit is contained in:
@@ -26,8 +26,8 @@ module.exports = class ItemPageController extends BaseController
|
||||
options.templateName = 'item_page'
|
||||
super options
|
||||
|
||||
@imageLoader = options.imageLoader
|
||||
@storage = options.storage
|
||||
@_imageLoader = options.imageLoader
|
||||
@_storage = options.storage
|
||||
|
||||
# Event Methods ################################################################################
|
||||
|
||||
@@ -37,23 +37,21 @@ module.exports = class ItemPageController extends BaseController
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
onWillRender: ->
|
||||
@storage.register 'crafting-plan', @model.plan, 'includingTools'
|
||||
@model.modPack.on Event.add, (modVersion)=>
|
||||
@storage.register "mod-version:#{modVersion.slug}", modVersion, 'enabled'
|
||||
@_storage.register 'crafting-plan', @model.plan, 'includingTools'
|
||||
super
|
||||
|
||||
onDidRender: ->
|
||||
@wantController = @addChild InventoryController, '.want',
|
||||
editable: true
|
||||
icon: '/images/fishing_rod.png'
|
||||
imageLoader: @imageLoader
|
||||
imageLoader: @_imageLoader
|
||||
model: @model.plan.want
|
||||
modPack: @model.modPack
|
||||
title: 'Items you want'
|
||||
|
||||
@haveController = @addChild InventoryController, '.have',
|
||||
editable: true,
|
||||
imageLoader: @imageLoader
|
||||
imageLoader: @_imageLoader
|
||||
model: @model.plan.have
|
||||
modPack: @model.modPack
|
||||
nameFinder: new NameFinder @model.modPack, includeGatherable:true
|
||||
@@ -62,17 +60,20 @@ module.exports = class ItemPageController extends BaseController
|
||||
@needController = @addChild InventoryController, '.need',
|
||||
editable: false
|
||||
icon: '/images/boots.png'
|
||||
imageLoader: @imageLoader
|
||||
imageLoader: @_imageLoader
|
||||
model: @model.plan.need
|
||||
modPack: @model.modPack
|
||||
title: "Items you'll need"
|
||||
|
||||
@craftingTableController = @addChild CraftingTableController, '.view__crafting_table',
|
||||
imageLoader: @imageLoader
|
||||
imageLoader: @_imageLoader
|
||||
model: @model.table
|
||||
modPack: @model.modPack
|
||||
|
||||
@modPackController = @addChild ModPackController, '.view__mod_pack', model:@model.modPack
|
||||
@modPackController = @addChild ModPackController, '.view__mod_pack',
|
||||
model: @model.modPack
|
||||
plan: @model.plan
|
||||
storage: @_storage
|
||||
|
||||
@$('.want .toolbar').append '<label><input class="includeTools" type="checkbox"> include tools</label>'
|
||||
@$includeToolsBox = @$('.includeTools')
|
||||
|
||||
Reference in New Issue
Block a user