Пример #1
0
 internal void Clean()
 {
     Targeting = null;
     FakeController.SlimBlock = null;
     MyCubeBocks.ClearImmediate();
     MostBlocks     = 0;
     PowerCheckTick = 0;
     SuspectedDrone = false;
     Powered        = false;
 }
Пример #2
0
 public void Clean()
 {
     EnemySafeInside = false;
     RefreshNow      = false;
     Touched         = false;
     Slowed          = false;
     CacheBlockList.ClearImmediate();
     RefreshTick           = 0;
     LastCollision         = 0;
     ConsecutiveCollisions = 0;
     LastTick = 0;
 }
Пример #3
0
        public SpraySoundEmitter(Func <Vector3D> positionGetter, Func <bool> realisticIsHoldingCondition)
        {
            if (positionGetter == null)
            {
                throw new ArgumentNullException("positionGetter");
            }

            if (realisticIsHoldingCondition == null)
            {
                throw new ArgumentNullException("realisticIsHoldingCondition");
            }

            SoundEmitter   = new MyEntity3DSoundEmitter(null);
            PositionGetter = positionGetter;

            // remove all 2D forcing conditions
            ConcurrentCachingList <Delegate> shouldPlay2D = SoundEmitter.EmitterMethods[(int)MyEntity3DSoundEmitter.MethodsEnum.ShouldPlay2D];

            shouldPlay2D.ClearImmediate();
            shouldPlay2D.Add(new Func <bool>(EmitterPlay2D)); // if no methods are declared, it defaults to always 2D

            if (MyAPIGateway.Session.SessionSettings.RealisticSound)
            {
                // remove some unnecessary conditions
                foreach (ConcurrentCachingList <Delegate> funcList in SoundEmitter.EmitterMethods.Values)
                {
                    foreach (Delegate func in funcList)
                    {
                        switch (func.Method.Name)
                        {
                        case "IsCurrentWeapon":
                        case "IsControlledEntity":
                        case "IsOnSameGrid":
                            funcList.Remove(func);
                            break;
                        }
                    }
                }

                // custom IsCurrentWeapon because Entity is not set for this emitter to detect on its own
                SoundEmitter.EmitterMethods[(int)MyEntity3DSoundEmitter.MethodsEnum.CanHear].Add(realisticIsHoldingCondition);

                //foreach(KeyValuePair<int, ConcurrentCachingList<Delegate>> kv in SoundEmitter.EmitterMethods)
                //{
                //    kv.Value.ApplyChanges();
                //    foreach(Delegate func in kv.Value)
                //    {
                //        Log.Info($"{((MyEntity3DSoundEmitter.MethodsEnum)kv.Key)} {func.Method.Name}");
                //    }
                //}
            }
        }
 /// <summary>
 /// Stop the server on the game side. Called automatically.
 /// </summary>
 private void StopServer()
 {
     if (m_active && m_listenerThread != null)
     {
         m_listener.Stop();
         //m_listenerThread.Interrupt(); // will stop itself
         foreach (var client in m_clients)
         {
             client.TcpClient.Close();
         }
         m_clients.ClearImmediate();
         m_active = false;
     }
 }
Пример #5
0
 protected override void UnloadData()
 {
     m_receivedMsgHandlers.ClearImmediate();
     base.UnloadData();
 }
Пример #6
0
 internal void Clean()
 {
     Targeting = null;
     MyCubeBocks.ClearImmediate();
     MostBlocks = 0;
 }