buildUpdatePacketsFor method

List<NetworkerPacket<WorldInitialized>> buildUpdatePacketsFor(
  1. WorldState state,
  2. Iterable<Channel> connected,
  3. Set<Channel>? needsUpdate
)

Implementation

List<NetworkerPacket<WorldInitialized>> buildUpdatePacketsFor(
  WorldState state,
  Iterable<Channel> connected,
  Set<Channel>? needsUpdate,
) {
  needsUpdate ??= this.needsUpdate;
  if (needsUpdate.isEmpty) return [];
  final packets = <NetworkerPacket<WorldInitialized>>[];
  for (final channel in connected) {
    if (needsUpdate.contains(channel) || channel == kAnyChannel) {
      packets.add(
        NetworkerPacket(
          WorldInitialized(table: state.protectTable(channel)),
          channel,
        ),
      );
    }
  }
  return packets;
}