Esempio n. 1
0
        public override void ProcessPacket(DysonSphereAddLayerPacket packet, NebulaConnection conn)
        {
            DysonSphere sphere = GameMain.data.dysonSpheres[packet.StarIndex];

            if (sphere == null)
            {
                return;
            }
            using (Multiplayer.Session.DysonSpheres.IsIncomingRequest.On())
            {
                if (packet.LayerId != sphere.QueryLayerId())
                {
                    Multiplayer.Session.DysonSpheres.HandleDesync(packet.StarIndex, conn);
                    return;
                }
                sphere.AddLayer(packet.OrbitRadius, packet.OrbitRotation.ToQuaternion(), packet.OrbitAngularSpeed);
            }
            if (IsHost)
            {
                Multiplayer.Session.DysonSpheres.SendPacketToDysonSphereExcept(packet, packet.StarIndex, conn);
            }
        }
Esempio n. 2
0
 public static void AddLayer_Postfix(DysonSphere __instance, float orbitRadius, Quaternion orbitRotation, float orbitAngularSpeed)
 {
     if (!Multiplayer.IsActive)
     {
         return;
     }
     //If local is the author and not in the process of importing blueprint
     if (!Multiplayer.Session.DysonSpheres.IsIncomingRequest && !Multiplayer.Session.DysonSpheres.InBlueprint)
     {
         Multiplayer.Session.Network.SendPacket(new DysonSphereAddLayerPacket(__instance.starData.index, __instance.QueryLayerId(), orbitRadius, orbitRotation, orbitAngularSpeed));
     }
 }