diff options
author | Madeline <60828599+vesindolen@users.noreply.github.com> | 2020-12-05 19:24:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 19:24:47 -0500 |
commit | e4975d34ed1ae4711b6b18e25c97962b1b3904aa (patch) | |
tree | 33319bc9ea7a39f66ac8ebf5fede204c9d086176 | |
parent | 119abb807f0d1bebc5ae1826786d08139b741fd7 (diff) |
Teleporter can be broken and collected
-rw-r--r-- | models/crack.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/models/crack.js b/models/crack.js index e59ff6b..3f352f2 100644 --- a/models/crack.js +++ b/models/crack.js @@ -23,6 +23,8 @@ var tempResource = require("models/chunk"); var BLOCK_START_TILE = tempResource.BLOCK_START_TILE; var BLOCK_TILE_AMOUNT = tempResource.BLOCK_TILE_AMOUNT; var EMPTY_TILE = tempResource.EMPTY_TILE; +var TELEPORTER_START_TILE = tempResource.TELEPORTER_START_TILE; +var TELEPORTER_TILE_AMOUNT = tempResource.TELEPORTER_TILE_AMOUNT; Crack.prototype.tick = function() { Entity.prototype.tick.call(this); @@ -35,9 +37,10 @@ Crack.prototype.tick = function() { Crack.prototype.giveTileToPlayer = function() { var tempTile = chunkUtils.getTile(this.pos); - if (tempTile < BLOCK_START_TILE || tempTile >= BLOCK_START_TILE + BLOCK_TILE_AMOUNT) { - return; - } + var isAcceptableBlock = (tempTile >= BLOCK_START_TILE && tempTile < BLOCK_START_TILE + BLOCK_TILE_AMOUNT) || + (tempTile >= TELEPORTER_START_TILE && tempTile < TELEPORTER_START_TILE + TELEPORTER_TILE_AMOUNT); + if (!isAcceptableBlock) + return; var tempPlayer = gameUtils.getPlayerByUsername(this.username); if (tempPlayer === null) { return; |