Barbosik / MultiOgar

An open source Ogar server implementation, written with Node.js.
Other
61 stars 44 forks source link

Fixed cell switch #460

Closed AlexHGaming closed 7 years ago

AlexHGaming commented 7 years ago

Define cell into cell1 Then do the following: // move player cells this.updateRemerge(cell1, client); this.moveCell(cell1); this.movePlayer(cell1, client); this.autoSplit(cell1, client); <----- find this part. this.updateNodeQuad(cell1);

Do a line break between this.autoSplit and this.uppdateNodeQuad so: `this.autoSplit (cell1, client);

this.updateNodeQuad(cell1); paste in the line break: this.quadTree.find(cell.quadItem.bound, function(check) { if (check.cell === cell) return; var m = self.checkCellCollision(cell, check.cell); if (self.checkRigidCollision(m)) { self.resolveRigidCollision(m); processedEats++; } });`

So basically do it like this:

` // move player cells this.updateRemerge(cell1, client); this.moveCell(cell1); this.movePlayer(cell1, client); this.autoSplit(cell1, client);

        this.quadTree.find(cell.quadItem.bound, function(check) {
             if (check.cell === cell) return;
             var m = self.checkCellCollision(cell, check.cell);
             if (self.checkRigidCollision(m)) {
                 self.resolveRigidCollision(m);
                 processedEats++;
             }
         });

            this.updateNodeQuad(cell1);
            // Scan for player cells collisions`