Bababot AntiDot Plugin

Bababot

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Bababot AntiDot Plugin
// @namespace    https://github.com/bababoyisntapopularname
// @version      v1.0public
// @license      GPLv3
// @description  Bababot
// @author       Bababoy
// @match        https://pixelplace.io/*
// @icon         https://i.imgur.com/PCn4MjQ.png
// @run-at       document-start
// @grant        none
// ==/UserScript==

/* antiDot API:
    antiDot(name) -> None:
        creates a new antiDot object with the given name on global scope
    antiDot:
        protectedArea : [ [x1, x2], [y1, y2] ] protects the area defined by protectedArea
        color         : color id (0-38) of pixels to be placed
        targetColor?  : optional color id (0-38) for antiDot to only replace pixels with
        destroy()     : stops the antiDot
        activate()    : activates the antiDot
*/
/* globals Tasker, BababotWS */
function antiDot(globalName) {
  var cfg = {
    protectedArea: undefined,
    color: undefined,
    targetColor: undefined,
  };
  var destroyed = false;
  Bababot.BababotWS.BBY_on("p", function (content) {
    for (let colorPacket of content) {
      let x = colorPacket[0];
      let y = colorPacket[1];
      let color = colorPacket[2];
      if (
        cfg.protectedArea[0][1] > x &&
        x > cfg.protectedArea[0][0] &&
        cfg.protectedArea[1][1] > y &&
        y > cfg.protectedArea[1][0]
      ) {
        if (cfg.targetColor != undefined && cfg.targetColor != color) {
          continue;
        }
        if (color != cfg.color) {
          Bababot.Tasker.addTask({ x: x, y: y, color: cfg.color });
        }
      }
    }
  });
  function destroy() {
    destroyed = true;
  }
  function activate() {
    destroyed = false;
  }
  window[globalName || "stuff"] = {
    config: cfg,
    code: 0,
    tasker: Bababot.Tasker,
    destroy: destroy,
    activate: activate,
  };
}
window.antiDot = antiDot;