DrMeepso / CovePlugins

A Collection of plugins for Cove
2 stars 2 forks source link

Persistent Chalk does not properly load/unload #7

Closed ShadowJonathan closed 12 hours ago

ShadowJonathan commented 14 hours ago

It's really unclear what is happening here, but it seems that saved chalk is either not saved completely, or saved in such a way that loading it makes it not load client-side.

Its possible that dictionary ordering is a thing here, where clients expect certain data to appear first, which gets reshuffled due to the load/unload?

Here's an example of whats happening;

image image

(The "t" in "test" is suddenly gone)

ShadowJonathan commented 13 hours ago

I think I might have found out why this happens, but this implies that this would happen more often with regular players joining the server?

Essentially, the latest chalk would be removed and become invisible.

Here's a patch to possibly fix it server-side

diff --git a/Cove/Server/Server.Packet.cs b/Cove/Server/Server.Packet.cs
--- a/Cove/Server/Server.Packet.cs  (revision afd1b3dea0c1fdffedfd5751bd913ae428ed4f57)
+++ b/Cove/Server/Server.Packet.cs  (date 1733256258056)
@@ -203,6 +203,8 @@
                         i++;
                     }

+                    chunks.Add(chunk);
+
                     for (int index = 0; index < chunks.Count; index++)
                     {
                         Dictionary<string, object> chalkPacket = new Dictionary<string, object> { { "type", "chalk_packet" }, { "canvas_id", canvas.canvasID }, { "data", chunks[index] } };

edit: Can confirm that adding this patch fixed the few issues I've had with chalk.