correct names of placeAllowed and REQUEST_PIXEL_UPDATE because of changed meaning

This commit is contained in:
HF 2021-01-27 02:16:14 +01:00
parent 1735643b32
commit 3762e74102
7 changed files with 20 additions and 24 deletions

View File

@ -114,10 +114,10 @@ export function toggleOpenMenu(): Action {
};
}
export function setPlaceAllowed(placeAllowed: boolean): Action {
export function setPlaceAllowed(requestingPixel: boolean): Action {
return {
type: 'SET_PLACE_ALLOWED',
placeAllowed,
requestingPixel,
};
}
@ -357,7 +357,7 @@ export function updatePixel(
color: ColorIndex,
): Action {
return {
type: 'RECEIVE_PIXEL_UPDATE',
type: 'UPDATE_PIXEL',
i,
j,
offset,

View File

@ -28,7 +28,7 @@ export type Action =
| { type: 'SELECT_STYLE', style: string }
| { type: 'SET_NOTIFICATION', notification: string }
| { type: 'UNSET_NOTIFICATION' }
| { type: 'SET_PLACE_ALLOWED', placeAllowed: boolean }
| { type: 'SET_PLACE_ALLOWED', requestingPixel: boolean }
| { type: 'SET_HOVER', hover: Cell }
| { type: 'UNSET_HOVER' }
| { type: 'SET_WAIT', wait: ?number }
@ -48,7 +48,7 @@ export type Action =
| { type: 'PRE_LOADED_BIG_CHUNK', center: Cell }
| { type: 'RECEIVE_BIG_CHUNK', center: Cell, chunk: Uint8Array }
| { type: 'RECEIVE_BIG_CHUNK_FAILURE', center: Cell, error: Error }
| { type: 'RECEIVE_PIXEL_UPDATE',
| { type: 'UPDATE_PIXEL',
i: number,
j: number,
offset: number,

View File

@ -12,7 +12,7 @@ export type UserState = {
wait: ?Date,
coolDown: ?number, // ms
lastCoolDownEnd: ?Date,
placeAllowed: boolean,
requestingPixel: boolean,
online: ?number,
// messages are sent by api/me, like not_verified status
messages: Array,
@ -45,7 +45,7 @@ const initialState: UserState = {
wait: null,
coolDown: null,
lastCoolDownEnd: null,
placeAllowed: true,
requestingPixel: true,
online: null,
messages: [],
mailreg: false,
@ -82,10 +82,10 @@ export default function user(
}
case 'SET_PLACE_ALLOWED': {
const { placeAllowed } = action;
const { requestingPixel } = action;
return {
...state,
placeAllowed,
requestingPixel,
};
}

View File

@ -66,7 +66,7 @@ export default (store) => (next) => (action) => {
break;
}
case 'RECEIVE_PIXEL_UPDATE': {
case 'UPDATE_PIXEL': {
const {
i,
j,

View File

@ -384,7 +384,7 @@ class Renderer {
isLightGrid,
} = state.gui;
const {
placeAllowed,
requestingPixel,
} = state.user;
const {
view,
@ -404,13 +404,13 @@ class Renderer {
// if we have to render placeholder
const doRenderPlaceholder = (
viewscale >= 3
&& placeAllowed
&& requestingPixel
&& (hover || this.hover)
&& !isPotato
);
const doRenderPotatoPlaceholder = (
viewscale >= 3
&& placeAllowed
&& requestingPixel
&& (hover !== this.hover
|| this.forceNextRender
|| this.forceNextSubrender

View File

@ -392,7 +392,7 @@ class Renderer {
store,
} = this;
const {
placeAllowed,
requestingPixel,
} = store.getState().user;
mouse.set(
@ -408,7 +408,7 @@ class Renderer {
.add(intersect.face.normal.multiplyScalar(0.5))
.floor()
.addScalar(0.5);
if (!placeAllowed
if (!requestingPixel
|| target.clone().sub(camera.position).length() > 120) {
rollOverMesh.position.y = -10;
} else {
@ -436,7 +436,7 @@ class Renderer {
store,
} = this;
const {
placeAllowed,
requestingPixel,
} = store.getState().user;
mouse.set(0, 0);
@ -448,9 +448,9 @@ class Renderer {
.add(intersect.face.normal.multiplyScalar(0.5))
.floor()
.addScalar(0.5);
// TODO make rollOverMesh in a different color while placeAllowed false
// TODO make rollOverMesh in a different color while requestingPixel false
// instead of hiding it.... we can now queue Voxels
if (!placeAllowed
if (!requestingPixel
|| target.clone().sub(camera.position).length() > 50) {
rollOverMesh.position.y = -10;
} else {
@ -572,10 +572,10 @@ class Renderer {
const state = this.store.getState();
const {
placeAllowed,
requestingPixel,
isOnMobile,
} = state.user;
if (!placeAllowed || isOnMobile) {
if (!requestingPixel || isOnMobile) {
return;
}

View File

@ -117,10 +117,6 @@ function revertPredictionsAt(
clientPredictions = [];
return;
}
console.log(
`Reverting ${clientPredictions.length - p} client predictions`,
);
while (p < clientPredictions.length) {
const [i, j, offset, color] = clientPredictions[p];