Advertisement
TheForgotten_GP

Dithering 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)Dithering', 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 / 2) * 2
  7.             chunky = Math.floor(mouse.tileY / 2) * 2
  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. OWOP.world.setPixel(chunkx + x + y  , chunky + y + x , color)
  12.                 }
  13.             }
  14.         }
  15.         switch (mouse.buttons) {
  16.             case 1:
  17.                 setChunk()
  18.                 break;
  19.  
  20.             case 2:
  21.                 setChunk()
  22.                 break;
  23.         }
  24.     });
  25. }));
  26. //took me a bit to figure out F, but its good now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement