Added check for map state in map state network update
This commit is contained in:
parent
04dceef022
commit
c743901962
@ -365,31 +365,31 @@ function NetworkedMapAndTokens({ session }) {
|
|||||||
putToken(newToken);
|
putToken(newToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (id === "tokenStateEdit") {
|
if (id === "tokenStateEdit" && currentMapState) {
|
||||||
setCurrentMapState((prevMapState) => ({
|
setCurrentMapState((prevMapState) => ({
|
||||||
...prevMapState,
|
...prevMapState,
|
||||||
tokens: { ...prevMapState.tokens, ...data },
|
tokens: { ...prevMapState.tokens, ...data },
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (id === "tokenStateRemove") {
|
if (id === "tokenStateRemove" && currentMapState) {
|
||||||
setCurrentMapState((prevMapState) => ({
|
setCurrentMapState((prevMapState) => ({
|
||||||
...prevMapState,
|
...prevMapState,
|
||||||
tokens: omit(prevMapState.tokens, Object.keys(data)),
|
tokens: omit(prevMapState.tokens, Object.keys(data)),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (id === "mapDraw") {
|
if (id === "mapDraw" && currentMapState) {
|
||||||
addMapDrawActions(data, "mapDrawActionIndex", "mapDrawActions");
|
addMapDrawActions(data, "mapDrawActionIndex", "mapDrawActions");
|
||||||
}
|
}
|
||||||
if (id === "mapDrawIndex") {
|
if (id === "mapDrawIndex" && currentMapState) {
|
||||||
setCurrentMapState((prevMapState) => ({
|
setCurrentMapState((prevMapState) => ({
|
||||||
...prevMapState,
|
...prevMapState,
|
||||||
mapDrawActionIndex: data,
|
mapDrawActionIndex: data,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (id === "mapFog") {
|
if (id === "mapFog" && currentMapState) {
|
||||||
addMapDrawActions(data, "fogDrawActionIndex", "fogDrawActions");
|
addMapDrawActions(data, "fogDrawActionIndex", "fogDrawActions");
|
||||||
}
|
}
|
||||||
if (id === "mapFogIndex") {
|
if (id === "mapFogIndex" && currentMapState) {
|
||||||
setCurrentMapState((prevMapState) => ({
|
setCurrentMapState((prevMapState) => ({
|
||||||
...prevMapState,
|
...prevMapState,
|
||||||
fogDrawActionIndex: data,
|
fogDrawActionIndex: data,
|
||||||
|
Loading…
Reference in New Issue
Block a user