added iterationsper photo option

This commit is contained in:
APEX FIGHT
2025-04-08 21:30:21 -04:00
parent 8798d7b2a7
commit a2c522fea2
2 changed files with 5 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
{ {
"iterationsPerPhoto": 3,
"photoInterval": 2, "photoInterval": 2,
"targetColor": { "targetColor": {
"r": 85, "r": 85,
@@ -6,5 +7,5 @@
"b": 49, "b": 49,
"a": 255 "a": 255
}, },
"tolerance": 2 "tolerance": 20
} }

View File

@@ -11,6 +11,7 @@ const targetColor = config.targetColor;
const tolerance = config.tolerance; const tolerance = config.tolerance;
const iterationsPerPhoto = config.iterationsPerPhoto;
setInterval(eatDrywall, photoInterval * 1000); setInterval(eatDrywall, photoInterval * 1000);
@@ -53,7 +54,7 @@ function clickRandomPixelOfColor(width, height, image) {
} }
console.log(hits.length); console.log(hits.length);
clickRandomDrywalls(hits,width,1); clickRandomDrywalls(hits, width, iterationsPerPhoto);
} }
@@ -84,6 +85,7 @@ function compareColors(c1, c2) { //compare two rgba color structs
let sum2 = c2.r + c2.g + c2.b + c2.a; let sum2 = c2.r + c2.g + c2.b + c2.a;
if (Math.abs(sum1 - sum2) < (tolerance * 4)) { if (Math.abs(sum1 - sum2) < (tolerance * 4)) {
//console.log(Math.abs(sum1 - sum2));
return true; return true;
} else return false; } else return false;
} }