Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. if (player.body != null) { // Alive, update stuff
  2. player.fov += 1/20 * (player.body.fov * (1 + 0.002 * player.body.skill.level) - player.fov);
  3. player.guiData = player.gui.export();
  4. console.log(player.guiData.upgrades); /*************** logged here ****************/
  5. } else { // u dead bro
  6. sockets[player.id].emit('RIP');
  7. }
  8.  
  9. // Find what the user can see
  10. let visible = entity.map(function(e) {
  11. if (e.x > player.camera.x - player.fov/2 - 2*e.size &&
  12. e.x < player.camera.x + player.fov/2 + 2*e.size &&
  13. e.y > player.camera.y - player.fov/2/(16/9) - 2*e.size &&
  14. e.y < player.camera.y + player.fov/2/(16/9) + 2*e.size) {
  15. return e.camera();
  16. }
  17. }).filter(function(e) { return e; });
  18. visible.reverse(); // So it draws right
  19.  
  20. // Send it to the player
  21. sockets[player.id].emit(
  22. 'uplink',
  23. { x: player.camera.x, y: player.camera.y, view: player.fov },
  24. visible,
  25. player.guiData, /****************** Here it goes in ******************/
  26. [], //debugLines,
  27. [], //debugCircles,
  28. [] //debugRects
  29. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement