Fixed lava bug
This commit is contained in:
parent
3d1a6d9fe7
commit
eb8fa64602
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue