Exemplo n.º 1
0
        public Session()
        {
            UiInput            = new UiInput(this);
            HudUi              = new Hud(this);
            TargetUi           = new TargetUi(this);
            DsUtil             = new DSUtils(this);
            DsUtil2            = new DSUtils(this);
            StallReporter      = new StallReporter();
            InnerStallReporter = new StallReporter();
            Av                     = new RunAv(this);
            Api                    = new ApiBackend(this);
            ApiServer              = new ApiServer(this);
            Projectiles            = new Projectiles.Projectiles(this);
            AcqManager             = new AcquireManager(this);
            TerminalMon            = new TerminalMonitor(this);
            _cachedEwarPacket.Data = new List <EwarValues>(32);

            ProblemRep            = new ProblemReport(this);
            VisDirToleranceCosine = Math.Cos(MathHelper.ToRadians(VisDirToleranceAngle));
            AimDirToleranceCosine = Math.Cos(MathHelper.ToRadians(AimDirToleranceAngle));

            VoxelCaches[ulong.MaxValue] = new VoxelCache();

            HeatEmissives = CreateHeatEmissive();
            LoadVanillaData();

            for (int i = 0; i < AuthorSettings.Length; i++)
            {
                AuthorSettings[i] = -1;
            }
        }
Exemplo n.º 2
0
        public Session()
        {
            UiInput       = new UiInput(this);
            TargetUi      = new TargetUi(this);
            WheelUi       = new Wheel(this);
            HudUi         = new Hud(this);
            DsUtil        = new DSUtils(this);
            DsUtil2       = new DSUtils(this);
            StallReporter = new StallReporter(this);
            Av            = new RunAv(this);
            Api           = new ApiBackend(this);
            ApiServer     = new ApiServer(this);
            Projectiles   = new Projectiles.Projectiles(this);
            Proccessor    = new NetworkProccessor(this);

            VisDirToleranceCosine = Math.Cos(MathHelper.ToRadians(VisDirToleranceAngle));
            AimDirToleranceCosine = Math.Cos(MathHelper.ToRadians(AimDirToleranceAngle));
            HeatEmissives         = CreateHeatEmissive();

            LoadVanillaData();

            CoreWorkOpt.TaskType       = CastProhibit(CoreWorkOpt.TaskType, 5);
            CoreWorkOpt.MaximumThreads = 1;

            foreach (var suit in (PacketType[])Enum.GetValues(typeof(PacketType)))
            {
                PacketPools.Add(suit, new MyConcurrentPool <Packet>(128, packet => packet.CleanUp()));
            }
        }
Exemplo n.º 3
0
        internal void StartAmmoTask()
        {
            InventoryUpdate = true;
            if (ITask.valid && ITask.Exceptions != null)
            {
                TaskHasErrors(ref ITask, "ITask");
            }

            StallReporter.Start("StartAmmoTask", 3);
            foreach (var ai in GridsToUpdateInventories)
            {
                var logged = 0;
                foreach (var inventory in ai.InventoryMonitor.Values)
                {
                    var items = inventory?.GetItems();
                    if (items != null)
                    {
                        MyConcurrentList <MyPhysicalInventoryItem> phyItemList;
                        if (InventoryItems.TryGetValue(inventory, out phyItemList))
                        {
                            phyItemList.AddRange(items);
                        }
                        else if (logged++ == 0)
                        {
                            Log.Line($"phyItemList and inventory.entity is null in StartAmmoTask - grid:{ai.MyGrid.DebugName} - aiMarked:{ai.MarkedForClose} - cTick:{Tick - ai.AiCloseTick} - mTick:{Tick - ai.AiMarkedTick} - sTick:{Tick - ai.CreatedTick}");
                        }
                    }
                }
            }
            StallReporter.End();

            DefIdsComparer.Clear();
            GridsToUpdateInventories.Clear();

            ITask = MyAPIGateway.Parallel.StartBackground(ProccessAmmoMoves, ProccessAmmoCallback);
        }