Fixed lava bug

This commit is contained in:
Ruben Müller 2014-12-07 18:17:33 +01:00
parent 3d1a6d9fe7
commit eb8fa64602

View file

@ -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 @currentLayer == allResourceTypes().length-1
# If we reach the bottom, the entity on top dies.
@entity = null if @currentLayer == allResourceTypes().length-1
@entity = null
@empty = true
tick: ->
@entity.tick @ if @entity