public void SendWorld(int playerId) { var player = Players[playerId]; //Send(new PauseGamePacket //{ // Reason = $"{player.Username} is downloading the world", // ExceptID = playerId //}); Log.WriteLine("Sending world to player " + playerId); IsSendingWorld = true; byte[] world = World.Serialize(); Packet packet = new WorldDataPacket { Data = world }; var msg = packet.GetMessage(Server); PacketLog.LogSend(packet); player.Connection.SendMessage(msg, NetDeliveryMethod.ReliableOrdered, 0); player.Connection.SendMessage(CircuitStatePacket.Build(true).GetMessage(Server), NetDeliveryMethod.ReliableOrdered, 0); }
public static void OnCircuitLogicUpdatePostfix() { if (Network.IsServer) { bool full = UpdateCounter++ % Constants.SendFullCircuitEachXUpdates == 0; var packet = CircuitStatePacket.Build(full); if (packet.Count > 0) { Network.SendPacket(packet); } } }