diff --git a/src/tiles/tile.coffee b/src/tiles/tile.coffee index 814f286..2100ce9 100644 --- a/src/tiles/tile.coffee +++ b/src/tiles/tile.coffee @@ -10,6 +10,7 @@ class Tile ) @currentLayer = 0 + @empty = false @entity = null @isActive = false @isBuildable = !(Math.round(Math.random()*10) == 5) @@ -19,15 +20,18 @@ class Tile # Some tiles are not buildable return unless @isBuildable - if button == "left" + if button == "left" and !@empty 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 + + if @currentLayer == allResourceTypes().length-1 + # If we reach the bottom, the entity on top dies. + @entity = null + @empty = true tick: -> @entity.tick @ if @entity