Advertisement
Guest User

bbbb

a guest
May 27th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. javascript: function upgrade(x, y) {
  2. if (mp < cellCost(x, y) || map[x][y][1] >= 15) return;
  3. var act = false;
  4. if (x - 1 > -1) {
  5. if (map[x - 1][y][0] == socketId) act = true
  6. }
  7. if (x + 1 < mapSize) {
  8. if (map[x + 1][y][0] == socketId) act = true
  9. }
  10. if (y - 1 > -1) {
  11. if (map[x][y - 1][0] == socketId) act = true
  12. }
  13. if (y + 1 < mapSize) {
  14. if (map[x][y + 1][0] == socketId) act = true
  15. }
  16. if (!act) return;
  17. mp += -cellCost(x, y);
  18. refresh();
  19. socket.emit('upgrade', x, y);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement