Skip to content

Commit a1dbb90

Browse files
committed
Improve fog syncing
1 parent 06e61ce commit a1dbb90

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

client/src/pages/tabletop-page/tabletop-component/table-canvas/table-canvas.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ export default class TableCanvas extends SuperComponent<ITableCanvas>{
9898

9999
private inbox({ type, data }) {
100100
switch (type) {
101+
case "room:tabletop:fog:add":
102+
this.fogOfWar = data.fogOfWar;
103+
this.fogOfWarShapes.push(data.fogOfWarShapes);
104+
this.updateFog = true;
105+
this.render();
106+
break;
101107
case "room:tabletop:fog:sync":
102108
this.fogOfWar = data.fogOfWar;
103109
this.fogOfWarShapes = data.fogOfWarShapes;
@@ -123,7 +129,7 @@ export default class TableCanvas extends SuperComponent<ITableCanvas>{
123129
}
124130

125131
private sync(shape:FogOfWarShape) {
126-
send("room:tabletop:fog:sync", shape);
132+
send("room:tabletop:fog:add", shape);
127133
}
128134

129135
private revealShapes() {

server/views/layouts/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
66

7-
<title>Tabletopper v0.6.3</title>
7+
<title>Tabletopper v0.6.4</title>
88
<meta name="description" content="Jump into a D&D tabletop session with your friends, hassle free.">
99

1010
<link rel="icon" href="/static/favicon.png" sizes="any">

server/views/layouts/vtt.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
66

7-
<title>Tabletopper v0.6.3</title>
7+
<title>Tabletopper v0.6.4</title>
88
<meta name="description" content="Jump into a D&D tabletop session with your friends, hassle free.">
99

1010
<link rel="icon" href="/static/favicon.png" sizes="any">

wss/src/game.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GameManager {
4040
this.error(ws, "Action Failed", `Room ${ws.room} is no longer available.`);
4141
}
4242
break;
43-
case "room:tabletop:fog:sync":
43+
case "room:tabletop:fog:add":
4444
if (room){
4545
room.syncFog(data);
4646
} else {

wss/src/room.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class Room {
7171
return;
7272
}
7373
this.fogOfWarShapes.push(shape);
74-
this.broadcast("room:tabletop:fog:sync", {
75-
fogOfWarShapes: this.fogOfWarShapes,
74+
this.broadcast("room:tabletop:fog:add", {
75+
fogOfWarShapes: shape,
7676
fogOfWar: this.fogOfWar,
7777
});
7878
}

0 commit comments

Comments
 (0)