Example #1
0
 public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
 {
     if (GameMain.Client.MidRoundSyncing)
     {
         //delay reading the state until midround syncing is done
         //because some of the wires connected to the panel may not exist yet
         long msgStartPos = msg.Position;
         foreach (Connection connection in Connections)
         {
             for (int i = 0; i < Connection.MaxLinked; i++)
             {
                 msg.ReadUInt16();
             }
         }
         ushort disconnectedWireCount = msg.ReadUInt16();
         for (int i = 0; i < disconnectedWireCount; i++)
         {
             msg.ReadUInt16();
         }
         int msgLength = (int)(msg.Position - msgStartPos);
         msg.Position = msgStartPos;
         StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime, waitForMidRoundSync: true);
     }
     else
     {
         ApplyRemoteState(msg);
     }
 }
Example #2
0
        public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
        {
            if (correctionTimer > 0.0f)
            {
                StartDelayedCorrection(type, msg.ExtractBits(5), sendingTime);
                return;
            }

            targetForce = msg.ReadRangedInteger(-10, 10) * 10.0f;
        }
Example #3
0
        public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
        {
            if (correctionTimer > 0.0f)
            {
                StartDelayedCorrection(type, msg.ExtractBits(4 + 8), sendingTime);
                return;
            }

            RechargeSpeed = msg.ReadRangedInteger(0, 10) / 10.0f * maxRechargeSpeed;
            Charge        = msg.ReadRangedSingle(0.0f, 1.0f, 8) * capacity;
        }
Example #4
0
 public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
 {
     if (GameMain.Client.MidRoundSyncing)
     {
         //delay reading the state until midround syncing is done
         //because some of the wires connected to the panel may not exist yet
         int bitsToRead = Connections.Count * Connection.MaxLinked * 16;
         StartDelayedCorrection(type, msg.ExtractBits(bitsToRead), sendingTime, waitForMidRoundSync: true);
     }
     else
     {
         ApplyRemoteState(msg);
     }
 }
Example #5
0
        public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
        {
            if (correctionTimer > 0.0f)
            {
                StartDelayedCorrection(type, msg.ExtractBits(16 + 1 + 15 + 8 + 8), sendingTime);
                return;
            }

            Temperature = msg.ReadRangedSingle(0.0f, 10000.0f, 16);

            AutoTemp     = msg.ReadBoolean();
            ShutDownTemp = msg.ReadRangedSingle(0.0f, 10000.0f, 15);

            CoolingRate = msg.ReadRangedSingle(0.0f, 100.0f, 8);
            FissionRate = msg.ReadRangedSingle(0.0f, 100.0f, 8);
        }
Example #6
0
        public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
        {
            if (correctionTimer > 0.0f)
            {
                StartDelayedCorrection(type, msg.ExtractBits(1 + 1 + 8 + 8 + 8 + 8), sendingTime);
                return;
            }

            AutoTemp            = msg.ReadBoolean();
            shutDown            = msg.ReadBoolean();
            Temperature         = msg.ReadRangedSingle(0.0f, 100.0f, 8);
            targetFissionRate   = msg.ReadRangedSingle(0.0f, 100.0f, 8);
            targetTurbineOutput = msg.ReadRangedSingle(0.0f, 100.0f, 8);
            degreeOfSuccess     = msg.ReadRangedSingle(0.0f, 1.0f, 8);

            fissionRateScrollBar.BarScroll   = targetFissionRate / 100.0f;
            turbineOutputScrollBar.BarScroll = targetTurbineOutput / 100.0f;
            onOffSwitch.BarScroll            = shutDown ? Math.Max(onOffSwitch.BarScroll, 0.55f) : Math.Min(onOffSwitch.BarScroll, 0.45f);
        }