don't draw pixelNofitication on own pixels
This commit is contained in:
parent
c2cbca1387
commit
9d46ec2e1c
|
@ -358,11 +358,18 @@ export function receiveCoolDown(
|
|||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* draw pixel on canvas
|
||||
* @param i, j, offset Chunk and offset in chunk
|
||||
* @param color integer Color Index
|
||||
* @param notify Bool if pixel notification appears (false when my own pixel)
|
||||
*/
|
||||
export function updatePixel(
|
||||
i,
|
||||
j,
|
||||
offset,
|
||||
color,
|
||||
notify = true,
|
||||
) {
|
||||
return {
|
||||
type: 'UPDATE_PIXEL',
|
||||
|
@ -370,6 +377,7 @@ export function updatePixel(
|
|||
j,
|
||||
offset,
|
||||
color,
|
||||
notify,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ export type Action =
|
|||
j: number,
|
||||
offset: number,
|
||||
color: ColorIndex,
|
||||
notify: boolean,
|
||||
}
|
||||
| { type: 'RECEIVE_ONLINE', online: number }
|
||||
| { type: 'RECEIVE_CHAT_MESSAGE',
|
||||
|
|
|
@ -320,6 +320,7 @@ class SocketServer {
|
|||
}
|
||||
client = it.next();
|
||||
}
|
||||
console.log(online);
|
||||
socketEvents.broadcastOnlineCounter(online);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,9 +101,10 @@ export default (store) => (next) => (action) => {
|
|||
j,
|
||||
offset,
|
||||
color,
|
||||
notify,
|
||||
} = action;
|
||||
const renderer = getRenderer();
|
||||
renderer.renderPixel(i, j, offset, color);
|
||||
renderer.renderPixel(i, j, offset, color, notify);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,6 +236,7 @@ class Renderer {
|
|||
j: number,
|
||||
offset: number,
|
||||
color,
|
||||
notify,
|
||||
) {
|
||||
const state = this.store.getState();
|
||||
const {
|
||||
|
@ -263,7 +264,9 @@ class Renderer {
|
|||
|
||||
context.fillStyle = palette.colors[color];
|
||||
context.fillRect(px, py, scaleM, scaleM);
|
||||
if (notify) {
|
||||
pixelNotify.addPixel(x, y);
|
||||
}
|
||||
|
||||
this.forceNextSubrender = true;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ function revertPredictionsAt(
|
|||
|
||||
while (p < clientPredictions.length) {
|
||||
const [i, j, offset, color] = clientPredictions[p];
|
||||
store.dispatch(updatePixel(i, j, offset, color));
|
||||
store.dispatch(updatePixel(i, j, offset, color, false));
|
||||
p += 1;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ export function tryPlacePixel(
|
|||
color,
|
||||
curColor,
|
||||
) {
|
||||
store.dispatch(updatePixel(i, j, offset, color));
|
||||
store.dispatch(updatePixel(i, j, offset, color, false));
|
||||
clientPredictions.push([i, j, offset, curColor, color]);
|
||||
|
||||
if (pixelQueue.length) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user