Send chunks to players connected to server
This commit is contained in:
@@ -16,7 +16,11 @@ let next_download = 1;
|
||||
|
||||
function post(message: GameToHost) {
|
||||
// the chunks are moved to the host, not copied
|
||||
const transfer = message.type === "save" ? message.save.chunks.map((chunk) => chunk.data.buffer) : [];
|
||||
const transfer = message.type === "save"
|
||||
? message.save.chunks.map((chunk) => chunk.data.buffer)
|
||||
: message.type === "send" && typeof message.data !== "string"
|
||||
? [message.data.buffer]
|
||||
: [];
|
||||
self.postMessage(message, transfer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user