From 1537f4c5dab7f2f047e31ec7f36ba7e612dfcc83 Mon Sep 17 00:00:00 2001 From: Shaun Date: Fri, 27 May 2022 21:13:03 +0200 Subject: [PATCH] chore: removed unused code --- src/server/world/atlas.js | 4 +- src/server/world/customMap.js | 105 ---------------------------------- 2 files changed, 2 insertions(+), 107 deletions(-) delete mode 100644 src/server/world/customMap.js diff --git a/src/server/world/atlas.js b/src/server/world/atlas.js index 1ad943cd..0062e06d 100644 --- a/src/server/world/atlas.js +++ b/src/server/world/atlas.js @@ -49,6 +49,8 @@ module.exports = { serverObj.zoneId = thread.id; serverObj.zoneName = thread.name; + serverObj.player.broadcastSelf(); + const simpleObj = obj.getSimple ? obj.getSimple(true, true) : obj; this.send(obj.zoneId, { @@ -290,8 +292,6 @@ module.exports = { delete serverObj.zoneId; delete obj.zoneId; - serverObj.player.broadcastSelf(); - const isRezone = true; await this.addObject(obj, keepPos, isRezone); }, diff --git a/src/server/world/customMap.js b/src/server/world/customMap.js deleted file mode 100644 index dc60cb11..00000000 --- a/src/server/world/customMap.js +++ /dev/null @@ -1,105 +0,0 @@ -module.exports = { - instance: null, - ent: null, - tiles: [], - oldTiles: {}, - - load: function (instance, objToAdd, callback) { - this.instance = instance; - - this.ent = instance.mapName + '-' + objToAdd.components.find(c => c.type === 'auth').username; - - io.get({ - ent: this.ent, - field: 'customMap', - callback: this.onLoad.bind(this, callback) - }); - }, - - onLoad: function (callback, result) { - this.tiles = JSON.parse(result || '[]'); - this.build(callback); - }, - - save: async function () { - await io.setAsync({ - key: this.ent, - table: 'customMap', - value: this.tiles, - serialize: true - }); - }, - - build: function (callback) { - this.tiles.forEach(function (t) { - t = t.split('|'); - this.customize(t[0], t[1], t[2], true); - }, this); - - this.save(); - - callback(); - }, - - customize: function (x, y, tile, noStore) { - let action = null; - if (arguments.length === 1) { - action = x; - let obj = action.obj; - tile = action.tile; - x = obj.x; - y = obj.y; - - if (action.destroy) { - x += action.direction.x; - y += action.direction.y; - } - } - - let collide = true; - - if (!noStore) { - let exists = this.tiles.find(function (t) { - t = t.split('|'); - if ((t[0] === x) && (t[1] === y)) - return true; - }); - if (exists) { - tile = this.oldTiles[x + '|' + y]; - collide = false; - - this.tiles.spliceWhere(t => t === exists); - } else if (this.instance.map.clientMap.collisionMap[x][y]) { - //Can't build on natural collisions - return; - } else - this.tiles.push(x + '|' + y + '|' + tile); - } - - if ((collide) && (!this.oldTiles[x + '|' + y])) { - let oldTile = this.instance.map.clientMap.map[x][y]; - this.oldTiles[x + '|' + y] = oldTile - 1; - } - - this.instance.map.clientMap.map[x][y] = tile; - - this.instance.map.clientMap.collisionMap[x][y] = collide; - this.instance.physics.graph.grid[x][y] = !collide; - - if (!noStore) - this.save(); - - if (action) { - action.result = { - x: x, - y: y, - tile: tile, - collide: collide - }; - } - }, - - placeTile: function (obj) { - this.customize(obj.x, obj.y, 52); - } -};