summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadeline <60828599+vesindolen@users.noreply.github.com>2020-12-05 19:22:32 -0500
committerGitHub <noreply@github.com>2020-12-05 19:22:32 -0500
commit119abb807f0d1bebc5ae1826786d08139b741fd7 (patch)
tree2c87e7cc7d75fc0587df693a658b680b9d664812
parent241eaad525221a5ab17d651f2f3c1c2f1c1ec1c4 (diff)
Teleportation mechanic
The actual thing where if the play walks on the teleporter they are teleported.
-rw-r--r--models/player.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/player.js b/models/player.js
index 704a233..659b708 100644
--- a/models/player.js
+++ b/models/player.js
@@ -14,6 +14,8 @@ var tempResource = require("models/chatMessage");
var announceMessageInChat = tempResource.announceMessageInChat;
var getNextChatMessageId = tempResource.getNextChatMessageId;
+
+
function Player(account) {
if ("respawnPos" in account) {
this.respawnPos = createPosFromJson(account.respawnPos);
@@ -91,6 +93,8 @@ var OVEN_TILE = tempResource.OVEN_TILE;
var HOSPITAL_TILE = tempResource.HOSPITAL_TILE;
var SYMBOL_START_TILE = tempResource.SYMBOL_START_TILE;
var SYMBOL_TILE_AMOUNT = tempResource.SYMBOL_TILE_AMOUNT;
+var TELEPORTER_START_TILE = tempResource.TELEPORTER_START_TILE;
+var TELEPORTER_TILE_AMOUNT = tempResource.TELEPORTER_TILE_AMOUNT;
var breadIngredientSet = [FLOUR_TILE, WATER_TILE, POWDER_TILE];
@@ -311,6 +315,12 @@ Player.prototype.walk = function(direction) {
chunkUtils.setTile(tempPos, TRAIL_START_TILE + this.avatar);
this.inventory.incrementTileCount(tempTile);
}
+ if (tempTile >= TELEPORTER_START_TILE && tempTile < TELEPORTER_START_TILE + TELEPORTER_TILE_AMOUNT)
+ {
+ var tempVec = entityWalkOffsetList[tempTile - TELEPORTER_START_TILE].copy();
+ tempVec.scale(2048);
+ this.pos.add(tempVec);
+ }
this.interactWithAdjacentTiles();
}