diff --git a/README.md b/README.md index 1616db8..f53b9e7 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Notes: Canvas specific configuartion like colors and cooldown is in `src/canvases.json` for all canvases. The CanvasSize is expected to be a power of 4 (4096, 16384, 65536) and not smaller than 256 and not larger than 65536 (you can however change the websocket packages in src/socket/packages/ to send chunk coordinates in 16bit and surpas that limit). -bcd is base cooldown for unset pixels, pcd is cooldown for placing on top of others, cds is stacktime, req is the requirement to be allowed to set on canvas in total pixels placed (or -1 for no requirement or 0 for having to be registered). `sd` is the start-date of the canvas, its used to know the oldest available backup (see Backup & Historical View section). All the cooldown values are in ms. +bcd is base cooldown for unset pixels, pcd is cooldown for placing on top of others, cds is stacktime, ranked if it counts towards the pixelPlaced stats, req is the requirement to be allowed to set on canvas in total pixels placed (or -1 for no requirement or 0 for having to be registered). `sd` is the start-date of the canvas, its used to know the oldest available backup (see Backup & Historical View section). All the cooldown values are in ms. cli is the numbers of colors to ignore for the player palette, i.e. the given world is made out of blue ocean and white continents with those two colors being the first two in the palette and they are used to know if a pixel got set by a player or not, so cli = 2 here. If you want to add a new canvas, be sure that you additionally create `public/loading${canvasId}.png`, `public/assets3d/normal${canvasId}.jpg`, `public/preview${canvasId}.png` and `public/assets3d/specular${canvasId}.jpg`, check out the existing ones to see what those files are for. If `v` is set to true for a canvas, it will be a 3D canvas. diff --git a/src/canvases.json b/src/canvases.json index 62bac84..f50e58b 100644 --- a/src/canvases.json +++ b/src/canvases.json @@ -41,6 +41,7 @@ "bcd": 4000, "pcd" : 7000, "cds": 60000, + "ranked" : true, "req": -1, "sd": "2020-01-08", "desc": "Our main canvas, a huge map of the world. Place everywhere you like" @@ -87,6 +88,7 @@ "bcd": 15000, "pcd": 15000, "cds": 900000, + "ranked" : true, "req": 8000, "sd": "2020-01-08", "desc": "Moon canvas with a pastel tone palette and black background" @@ -164,6 +166,7 @@ "bcd": 2000, "pcd" : 2000, "cds": 60000, + "ranked" : true, "req": 0, "sd": "2020-01-08", "desc": "Place Voxels on a 3D canvas with others" @@ -200,6 +203,7 @@ "bcd": 500, "pcd": 500, "cds": 60000, + "ranked" : false, "req": 0, "sd": "2020-03-15", "desc": "Special canvas to spread aweareness of coronavirus" diff --git a/src/core/constants.js b/src/core/constants.js index 113e285..652f144 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -55,6 +55,7 @@ export const DEFAULT_CANVASES = { bcd: 4000, pcd: 7000, cds: 60000, + ranked: true, req: -1, sd: '2020-01-08', }, diff --git a/src/core/draw.js b/src/core/draw.js index e34179c..58c052e 100644 --- a/src/core/draw.js +++ b/src/core/draw.js @@ -116,10 +116,10 @@ async function draw( } if (color < 0 || color >= canvas.colors.length) { - return { - error: 'Invalid color selected', - success: false, - }; + return { + error: 'Invalid color selected', + success: false, + }; } if (canvas.req !== -1) { @@ -176,7 +176,9 @@ async function draw( setPixel(canvasId, color, x, y, z); user.setWait(waitLeft, canvasId); - user.incrementPixelcount(); + if (canvas.ranked) { + user.incrementPixelcount(); + } return { success: true, waitSeconds: waitLeft / 1000,