Silo capacity

This commit is contained in:
Ruben Müller 2014-12-07 12:55:08 +01:00
parent 834239d184
commit 8236c2c887
2 changed files with 10 additions and 9 deletions

View File

@ -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) ->

View File

@ -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