Advertisement
TheForgotten_GP

Grid Tool OWOP

Mar 31st, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. OWOP.tool.addToolObject(new OWOP.tool.class('(TF)Grid', OWOP.cursors.erase, OWOP.fx.player.RECT_SELECT_ALIGNED(2), false, function(tool) {
  2.     tool.setEvent('mousemove mousedown', function(mouse, event) {
  3.         var color = mouse.buttons == 1 ? OWOP.player.selectedColor : [255, 255, 255];
  4.  
  5.         function setChunk() {
  6.             chunkx = Math.floor(mouse.tileX / 3) * 3
  7.             chunky = Math.floor(mouse.tileY / 3) * 3
  8.             for (var x = 0; x < 2; x++) {
  9.                 for (var y = 0; y < 2; y++) {
  10.                     OWOP.world.setPixel(chunkx + x + x, chunky + y + y, color)
  11.                 }
  12.             }
  13.         }
  14.         switch (mouse.buttons) {
  15.             case 1:
  16.                 setChunk()
  17.                 break;
  18.  
  19.             case 2:
  20.                 setChunk()
  21.                 break;
  22.         }
  23.     });
  24. }));
  25. //haha code go brrrrrrrrrrrrrrrrrrrrrrrrr - TF 2021
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement