chore(server): disable player buffer history in studio environment
Some checks failed
Deploy / Build & Deploy (push) Has been cancelled

This commit is contained in:
Khietsly Tristan 2026-02-25 11:21:36 +07:00
parent 704942c979
commit 80646eeebb
2 changed files with 399 additions and 397 deletions

View file

@ -37,7 +37,7 @@ Client.awaitReady = Replication.wait_for_ready
--@schema Buffer.SchemaType --@schema Buffer.SchemaType
-- Define a schema for strict data packing on a specific event. -- Define a schema for strict data packing on a specific event.
Client.useSchema = function(remoteName: string, schema: Buffer.SchemaType) Client.useSchema = function(remoteName: string, schema: Buffer.SchemaType)
local id = Replication.get_id(remoteName) local id = Replication.get_id[remoteName]
if not id then if not id then
warn(`[Warp]: ".useSchema"::"{remoteName}" does not exist, likely its not registered on the server yet.`) warn(`[Warp]: ".useSchema"::"{remoteName}" does not exist, likely its not registered on the server yet.`)
return return
@ -49,7 +49,7 @@ end
--@fn function --@fn function
-- Connect to an event to receive incoming data from the server. -- Connect to an event to receive incoming data from the server.
Client.Connect = function(remoteName: string, fn: (Player, ...any?) -> ...any?): Connection Client.Connect = function(remoteName: string, fn: (Player, ...any?) -> ...any?): Connection
local id = Replication.get_id(remoteName) local id = Replication.get_id[remoteName]
if not id then if not id then
warn(`[Warp]: ".Connect"::"{remoteName}" does not exist, likely its not registered on the server yet.`) warn(`[Warp]: ".Connect"::"{remoteName}" does not exist, likely its not registered on the server yet.`)
return { Connected = false, Disconnect = function() return end } :: Connection return { Connected = false, Disconnect = function() return end } :: Connection
@ -101,7 +101,7 @@ end
--@remoteName string --@remoteName string
-- Disconnect all connections for a specific event. -- Disconnect all connections for a specific event.
Client.DisconnectAll = function(remoteName: string) Client.DisconnectAll = function(remoteName: string)
local id = Replication.get_id(remoteName) local id = Replication.get_id[remoteName]
if not id then if not id then
return return
end end
@ -120,10 +120,10 @@ Client.Destroy = Client.DisconnectAll
--@reliable boolean --@reliable boolean
-- Fire an event to the server. -- Fire an event to the server.
Client.Fire = function(remoteName: string, reliable: boolean, ...: any?) Client.Fire = function(remoteName: string, reliable: boolean, ...: any?)
local id = Replication.get_id(remoteName) local id = Replication.get_id[remoteName]
if id then if id then
table.insert(reliable and queueEvent or queueUnreliableEvent, { table.insert(reliable and queueEvent or queueUnreliableEvent, {
Replication.get_id(remoteName), Replication.get_id[remoteName],
{ ... } :: any, { ... } :: any,
}) })
end end
@ -133,7 +133,7 @@ end
--@timeout number? --@timeout number?
-- Invoke the server with timeout support. Yields the current thread. Returns nil if timeout occurs. -- Invoke the server with timeout support. Yields the current thread. Returns nil if timeout occurs.
Client.Invoke = function(remoteName: string, timeout: number?, ...: any?): ...any? Client.Invoke = function(remoteName: string, timeout: number?, ...: any?): ...any?
local id = Replication.get_id(remoteName) local id = Replication.get_id[remoteName]
if not id then if not id then
return nil return nil
end end

View file

@ -186,9 +186,11 @@ if RunService:IsServer() then
if type(b) ~= "buffer" then if type(b) ~= "buffer" then
return return
end end
if not RunService:IsStudio() then
local bytes: number = (player_bytes[player] or 0) + math.max(buffer.len(b), 800) local bytes: number = (player_bytes[player] or 0) + math.max(buffer.len(b), 800)
if bytes > 8e3 then return end if bytes > 8e3 then return end
player_bytes[player] = bytes player_bytes[player] = bytes
end
local contents = Buffer.readEvents(b, ref, eventSchemas) local contents = Buffer.readEvents(b, ref, eventSchemas)
for _, content in contents do for _, content in contents do