public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { int msgStartPos = msg.BitPosition; float flowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f; bool isActive = msg.ReadBoolean(); bool hijacked = msg.ReadBoolean(); float?targetLevel; if (msg.ReadBoolean()) { targetLevel = msg.ReadSingle(); } else { targetLevel = null; } if (correctionTimer > 0.0f) { int msgLength = msg.BitPosition - msgStartPos; msg.BitPosition = msgStartPos; StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime); return; } FlowPercentage = flowPercentage; IsActive = isActive; Hijacked = hijacked; TargetLevel = targetLevel; }
public void ClientRead(ServerNetObject type, IReadMessage 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.BitPosition; msg.ReadUInt16(); //user ID foreach (Connection connection in Connections) { for (int i = 0; i < connection.MaxWires; i++) { msg.ReadUInt16(); } } ushort disconnectedWireCount = msg.ReadUInt16(); for (int i = 0; i < disconnectedWireCount; i++) { msg.ReadUInt16(); } int msgLength = (int)(msg.BitPosition - msgStartPos); msg.BitPosition = (int)msgStartPos; StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime, waitForMidRoundSync: true); } else { //don't trigger rewiring sounds if the rewiring is being done by the local user (in that case we'll trigger it locally) if (Character.Controlled == null || user != Character.Controlled) { TriggerRewiringSound(); } ApplyRemoteState(msg); } }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (correctionTimer > 0.0f) { StartDelayedCorrection(type, msg.ExtractBits(1 + 1 + 8 + 8 + 8 + 8), sendingTime); return; } AutoTemp = msg.ReadBoolean(); PowerOn = 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); if (Math.Abs(FissionRateScrollBar.BarScroll - targetFissionRate / 100.0f) > 0.01f) { FissionRateScrollBar.BarScroll = targetFissionRate / 100.0f; } if (Math.Abs(TurbineOutputScrollBar.BarScroll - targetTurbineOutput / 100.0f) > 0.01f) { TurbineOutputScrollBar.BarScroll = targetTurbineOutput / 100.0f; } IsActive = true; }
public void ClientRead(ServerNetObject type, IReadMessage 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.BitPosition; 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.BitPosition - msgStartPos); msg.BitPosition = (int)msgStartPos; StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime, waitForMidRoundSync: true); } else { ApplyRemoteState(msg); } }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (correctionTimer > 0.0f) { StartDelayedCorrection(type, msg.ExtractBits(5), sendingTime); return; } targetForce = msg.ReadRangedInteger(-10, 10) * 10.0f; }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (correctionTimer > 0.0f) { StartDelayedCorrection(type, msg.ExtractBits(5 + 1), sendingTime); return; } FlowPercentage = msg.ReadRangedInteger(-10, 10) * 10.0f; IsActive = msg.ReadBoolean(); }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (correctionTimer > 0.0f) { StartDelayedCorrection(type, msg.ExtractBits(4 + 8), sendingTime); return; } float rechargeRate = msg.ReadRangedInteger(0, 10) / 10.0f; RechargeSpeed = rechargeRate * MaxRechargeSpeed; #if CLIENT rechargeSpeedSlider.BarScroll = rechargeRate; #endif Charge = msg.ReadRangedSingle(0.0f, 1.0f, 8) * capacity; }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { if (correctionTimer > 0.0f) { StartDelayedCorrection(type, msg.ExtractBits(5 + 16), sendingTime); return; } targetForce = msg.ReadRangedInteger(-10, 10) * 10.0f; UInt16 userID = msg.ReadUInt16(); if (userID != Entity.NullEntityID) { User = Entity.FindEntityByID(userID) as Character; } }
public void ClientRead(ServerNetObject type, IReadMessage 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); IsActive = true; }
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime) { int msgStartPos = msg.BitPosition; bool autoPilot = msg.ReadBoolean(); bool dockingButtonClicked = msg.ReadBoolean(); Vector2 newSteeringInput = steeringInput; Vector2 newTargetVelocity = targetVelocity; float newSteeringAdjustSpeed = steeringAdjustSpeed; Vector2?newPosToMaintain = null; bool headingToStart = false; if (dockingButtonClicked) { item.SendSignal(0, "1", "toggle_docking", sender: null); } if (autoPilot) { if (msg.ReadBoolean()) { newPosToMaintain = new Vector2( msg.ReadSingle(), msg.ReadSingle()); } else { headingToStart = msg.ReadBoolean(); } } else { newSteeringInput = new Vector2(msg.ReadSingle(), msg.ReadSingle()); newTargetVelocity = new Vector2(msg.ReadSingle(), msg.ReadSingle()); newSteeringAdjustSpeed = msg.ReadSingle(); } if (correctionTimer > 0.0f) { int msgLength = (int)(msg.BitPosition - msgStartPos); msg.BitPosition = msgStartPos; StartDelayedCorrection(type, msg.ExtractBits(msgLength), sendingTime); return; } AutoPilot = autoPilot; if (!AutoPilot) { SteeringInput = newSteeringInput; TargetVelocity = newTargetVelocity; steeringAdjustSpeed = newSteeringAdjustSpeed; } else { MaintainPos = newPosToMaintain != null; posToMaintain = newPosToMaintain; if (posToMaintain == null) { LevelStartSelected = headingToStart; LevelEndSelected = !headingToStart; UpdatePath(); } else { LevelStartSelected = false; LevelEndSelected = false; } } }