ReplicationServer
此内容尚不支持你的语言。
Defined in: net/replication/server.ts:145
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ReplicationServer(
world):ReplicationServer
Defined in: net/replication/server.ts:279
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ReplicationServer
Properties
Section titled “Properties”leavesSent
Section titled “leavesSent”leavesSent:
number=0
Defined in: net/replication/server.ts:228
populationScans
Section titled “populationScans”populationScans:
number=0
Defined in: net/replication/server.ts:271
Accessors
Section titled “Accessors”clientIds
Section titled “clientIds”Get Signature
Section titled “Get Signature”get clientIds():
number[]
Defined in: net/replication/server.ts:374
Ready (handshaken) connection ids. Gameplay polls this each fixed tick to provision/retire per-player entities — no callback wiring needed.
Returns
Section titled “Returns”number[]
connectionCount
Section titled “connectionCount”Get Signature
Section titled “Get Signature”get connectionCount():
number
Defined in: net/replication/server.ts:368
Returns
Section titled “Returns”number
netIds
Section titled “netIds”Get Signature
Section titled “Get Signature”get netIds():
NetIds
Defined in: net/replication/server.ts:364
Returns
Section titled “Returns”NetIds
Get Signature
Section titled “Get Signature”get table():
ReplicationTable
Defined in: net/replication/server.ts:290
Lazily built so components defined after plugin install still count.
Returns
Section titled “Returns”ReplicationTable
Methods
Section titled “Methods”attachConnection()
Section titled “attachConnection()”attachConnection(
transport):number
Defined in: net/replication/server.ts:520
Accept a transport (server-side end of one client link).
Parameters
Section titled “Parameters”transport
Section titled “transport”Returns
Section titled “Returns”number
beginTick()
Section titled “beginTick()”beginTick(
fixedDelta):void
Defined in: net/replication/server.ts:612
Start a fixed tick: dequeue each connection’s next input command (the
plugin calls this in FixedPreUpdate, before gameplay). fixedDelta is
remembered for the handshake so clients replay with the server’s dt.
Parameters
Section titled “Parameters”fixedDelta
Section titled “fixedDelta”number
Returns
Section titled “Returns”void
detachConnection()
Section titled “detachConnection()”detachConnection(
id):void
Defined in: net/replication/server.ts:577
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: net/replication/server.ts:345
Give back everything this server holds outside itself: its channels, its claims on removal history, and its despawn subscription. Idempotent — the world would otherwise keep a dead server reachable, and its claims would pin removal rows for a session nobody is running.
Returns
Section titled “Returns”void
inputOf()
Section titled “inputOf()”inputOf(
connectionId):ReplInputMsg|null
Defined in: net/replication/server.ts:591
The latest input command a connection sent (null before the first). Gameplay reads this in FixedUpdate and applies it to the entities the connection owns (Replicated.owner). Latest-persists: a held command applies every tick until replaced.
Parameters
Section titled “Parameters”connectionId
Section titled “connectionId”number
Returns
Section titled “Returns”ReplInputMsg | null
sample()
Section titled “sample()”sample(
tick):void
Defined in: net/replication/server.ts:623
One replication tick: spawns/despawns on the control plane, dirty fields as binary delta frames (one shared broadcast without a policy, one filtered frame per connection with one). Runs in FixedPostUpdate.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
setInterestPolicy()
Section titled “setInterestPolicy()”setInterestPolicy(
policy):void
Defined in: net/replication/server.ts:398
Install (or replace / remove) the interest policy. With a policy, each ready connection only receives the entities the policy deems relevant to it; an entity entering a connection’s interest arrives as a full spawn, one leaving despawns its client ghost. Entities a connection owns are always relevant to it regardless of the policy. Safe to change mid-session: the next sample tick reconciles every connection’s ghost set against the new policy.
Parameters
Section titled “Parameters”policy
Section titled “policy”InterestPolicy | null
Returns
Section titled “Returns”void
setInterestProvider()
Section titled “setInterestProvider()”setInterestProvider(
provider):void
Defined in: net/replication/server.ts:409
Install a prepare-once/query-many provider. Shares the slot with setInterestPolicy: the last non-null setter wins, and null on either disables interest.
Parameters
Section titled “Parameters”provider
Section titled “provider”InterestProvider | null
Returns
Section titled “Returns”void
tickInputOf()
Section titled “tickInputOf()”tickInputOf(
connectionId):ReplInputMsg|null
Defined in: net/replication/server.ts:603
The input command dequeued for THIS fixed tick — each command is consumed exactly once, in order, one per tick (beginTick); when the queue runs dry the last command repeats (network jitter must not stall a held input). This is the accessor prediction-grade gameplay applies in FixedUpdate: the server acknowledges the consumed seq, and the client replays exactly the unacknowledged commands, one tick each.
Parameters
Section titled “Parameters”connectionId
Section titled “connectionId”number
Returns
Section titled “Returns”ReplInputMsg | null