Beispiel #1
0
        public void SendControlThrust(Vector3 controlThrust)
        {
            var msg = new ThrustMsg();
            msg.GridEntityId = Entity.EntityId;
            msg.Thrust = controlThrust;

            if (m_thrustState.ShouldSend(msg.ThrustData))
            {
                // Send to all because we want thrust animation on other ships
                if (msg.ThrustData == Vector3B.Zero)
                {
                    // Send zero thrust as reliable
                    var zeroMsg = new ThrustZeroMsg();
                    zeroMsg.GridEntityId = Entity.EntityId;
                    Sync.Layer.SendMessageToAll(ref msg);
                }
                else
                {
                    Sync.Layer.SendMessageToAll(ref msg);
                }
            }
        }
Beispiel #2
0
 private static void OnThrustReceived(MySyncGrid sync, ref ThrustMsg msg, MyNetworkClient sender)
 {
     sync.Entity.GridSystems.ThrustSystem.ControlThrust = msg.Thrust;
 }
Beispiel #3
0
        private static void OnThrustReceived(MySyncGrid sync, ref ThrustMsg msg, MyNetworkClient sender)
        {
            var thrustComp = sync.Entity.Components.Get<MyEntityThrustComponent>();
            if (thrustComp != null)
                thrustComp.ControlThrust = msg.Thrust;

            if (Sync.IsServer)
            {
                Sync.Layer.SendAsRpcToAllButOne(ref msg, sender.SteamUserId);
            }
        }