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
|
@currentLayer = 0
|
||||||
|
@empty = false
|
||||||
@entity = null
|
@entity = null
|
||||||
@isActive = false
|
@isActive = false
|
||||||
@isBuildable = !(Math.round(Math.random()*10) == 5)
|
@isBuildable = !(Math.round(Math.random()*10) == 5)
|
||||||
|
@ -19,15 +20,18 @@ class Tile
|
||||||
# Some tiles are not buildable
|
# Some tiles are not buildable
|
||||||
return unless @isBuildable
|
return unless @isBuildable
|
||||||
|
|
||||||
if button == "left"
|
if button == "left" and !@empty
|
||||||
if (app.game.availableSiloStorage() - app.game.usedSiloStorage()) > 0
|
if (app.game.availableSiloStorage() - app.game.usedSiloStorage()) > 0
|
||||||
if @layers[@currentLayer].collect()
|
if @layers[@currentLayer].collect()
|
||||||
name = app.layerIndexToName(@currentLayer)
|
name = app.layerIndexToName(@currentLayer)
|
||||||
app.game.resources[name] += 1
|
app.game.resources[name] += 1
|
||||||
else
|
else
|
||||||
@currentLayer += 1
|
@currentLayer += 1
|
||||||
|
|
||||||
|
if @currentLayer == allResourceTypes().length-1
|
||||||
# If we reach the bottom, the entity on top dies.
|
# If we reach the bottom, the entity on top dies.
|
||||||
@entity = null if @currentLayer == allResourceTypes().length-1
|
@entity = null
|
||||||
|
@empty = true
|
||||||
|
|
||||||
tick: ->
|
tick: ->
|
||||||
@entity.tick @ if @entity
|
@entity.tick @ if @entity
|
||||||
|
|
Loading…
Reference in a new issue