Advertisement
TheForgotten_GP

screen pixel brush

Dec 28th, 2023 (edited)
1,109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. OWOP.tool.addToolObject(new OWOP.tool.class('(L//H) screen pixel', OWOP.cursors.cursor, 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.         var ye = [color[0],color[0],0]
  5.         var ma = [color[0],0,color[0]]
  6.         function setChunk() {
  7.             chunkx = Math.floor(mouse.tileX / 2) * 2
  8.             chunky = Math.floor(mouse.tileY / 2) * 2
  9.             if (mouse.buttons == 2) {
  10.                 for (var x = 0; x < 2; x++) {
  11.                     for (var y = 0; y < 2; y++) {
  12.                         OWOP.world.setPixel(chunkx + x, chunky + y, [255, 255, 255])
  13.                     }
  14.                 }
  15.             }
  16.             else {
  17.                 OWOP.world.setPixel(chunkx ,chunky, ye)
  18.                 OWOP.world.setPixel(chunkx + 1 ,chunky, [0,color[1],0])
  19.                 OWOP.world.setPixel(chunkx ,chunky + 1, [0,0,color[2]])
  20.                 OWOP.world.setPixel(chunkx + 1 ,chunky + 1, ma)
  21.             }
  22.         }
  23.         switch (mouse.buttons) {
  24.             case 1:
  25.                 setChunk()
  26.                 break;
  27.  
  28.             case 2:
  29.                 setChunk()
  30.                 break;
  31.         }
  32.     });
  33. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement