From 8236c2c8870e08ea6ece3eb903ccf899e003c50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Sun, 7 Dec 2014 12:55:08 +0100 Subject: [PATCH] Silo capacity --- src/game.coffee | 4 ++-- src/tiles/tile.coffee | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/game.coffee b/src/game.coffee index d601502..c594ffe 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -50,11 +50,11 @@ app.game = tile.tick() for tile in app.game.map createMiner: -> - if @currentSelectedTile and @checkResource 'lubinit', 30, true + if @currentSelectedTile and @checkResource 'stardust', 1, true @currentSelectedTile.entity = new Miner createSilo: -> - if @currentSelectedTile and @checkResource 'oxodum', 20, true + if @currentSelectedTile and @checkResource 'stardust', 1, true @currentSelectedTile.entity = new Silo checkResource: (type, amount, drain = false) -> diff --git a/src/tiles/tile.coffee b/src/tiles/tile.coffee index fa31bcc..a2746f9 100644 --- a/src/tiles/tile.coffee +++ b/src/tiles/tile.coffee @@ -14,13 +14,14 @@ class Tile click: (button)-> if button == "left" - if @layers[@currentLayer].collect() - name = app.layerIndexToName(@currentLayer) - app.game.resources[name] += 1 - else - @currentLayer += 1 - # If we reach the bottom, the entity on top dies. - @entity = null if @currentLayer == allResourceTypes().length-1 + if (app.game.availableSiloStorage() - app.game.usedSiloStorage()) > 0 + if @layers[@currentLayer].collect() + name = app.layerIndexToName(@currentLayer) + app.game.resources[name] += 1 + else + @currentLayer += 1 + # If we reach the bottom, the entity on top dies. + @entity = null if @currentLayer == allResourceTypes().length-1 tick: -> @entity.tick @ if @entity