make cooldown linking configurable, remove hardcoded link between

minimap and earth
This commit is contained in:
HF 2024-02-22 18:30:13 +01:00
parent 6aed8bbb94
commit 6a4d2f01bf
4 changed files with 6 additions and 5 deletions

View File

@ -146,6 +146,7 @@ Meaning of some values:
| hid | Hidden canvases, can be just seen by pressing P (default: false)|
| sd | Start-date of the canvas (for historical view) |
| ed | end date for historical view (canvas retired) |
| linkcd | id of another canvas to take the cooldown from |
Notes:

View File

@ -373,6 +373,7 @@
"pcd" : 7000,
"cds": 60000,
"ranked" : true,
"linkcd" : 0,
"sd": "2024-02-22"
}
}

View File

@ -189,6 +189,7 @@ export default async function drawByOffsets(
user.country,
ranked,
canvasId,
canvas.linkcd ?? canvasId,
i, j,
clrIgnore,
req,

View File

@ -23,6 +23,8 @@ const PREFIX = 'cd';
* @param id userId
* @param ranked boolean if increasing rank (should only be true if logged in)
* @param clrIgnore, bcd, pcd, cds information about canvas
* @param canvasId id of the canvas we are placing on
* @param canvasCdId id of the canvas we take the cooldown from
* @param i, j chunk coordinates
* @param pxls Array with offsets of pixels
* @return see lua/placePixel.lua
@ -33,6 +35,7 @@ export default function allowPlace(
country,
ranked,
canvasId,
canvasCdId,
i, j,
clrIgnore,
req,
@ -44,11 +47,6 @@ export default function allowPlace(
) {
const isalKey = `${ALLOWED_PREFIX}:${ip}`;
const captKey = (CAPTCHA_TIME >= 0) ? `${CAPTCHA_PREFIX}:${ip}` : 'nope';
// ATTENTION: HARDCODED LINKED COODLOWN OF MINIMAP AND EARTH CANVAS
let canvasCdId = canvasId;
if (canvasId === 11) {
canvasCdId = 0;
}
const ipCdKey = `${PREFIX}:${canvasCdId}:ip:${ip}`;
let idCdKey;
if (id) {