Beispiel #1
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                //
                // Finish work from last frame
                //
                DsUtil.Start("projectiles2");
                Projectiles.Stage2();
                DsUtil.Complete("projectiles2", true);

                DsUtil.Start("damage");
                if (_effectedCubes.Count > 0)
                {
                    ApplyGridEffect();
                }

                if (Tick60)
                {
                    GridEffects();
                }

                if (Hits.Count > 0)
                {
                    ProcessHits();
                }
                DsUtil.Complete("damage", true);

                if (MpActive)
                {
                    DsUtil.Start("network1");
                    if (WeaponsToSync.Count > 0)
                    {
                        Proccessor.Proccess();
                    }
                    if (UiInput.InputChanged && ActiveControlBlock != null)
                    {
                        SendMouseUpdate(ActiveControlBlock);
                    }
                    if (ClientGridResyncRequests.Count > 0)
                    {
                        ProccessGridResyncRequests();
                    }

                    Proccessor.AddPackets();

                    if (PacketsToClient.Count > 0)
                    {
                        ProccessServerPacketsForClients();
                    }
                    if (PacketsToServer.Count > 0)
                    {
                        ProccessClientPacketsForServer();
                    }
                    if (ClientSideErrorPktList.Count > 0)
                    {
                        ReproccessClientErrorPackets();
                    }
                    DsUtil.Complete("network1", true);
                }

                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);
                //
                // Finished last frame
                //
                Timings();

                if (!WeaponAmmoRemoveQueue.IsEmpty && CTask.IsComplete)
                {
                    if (CTask.valid && CTask.Exceptions != null)
                    {
                        TaskHasErrors(ref CTask, "CTask");
                    }

                    CTask = MyAPIGateway.Parallel.StartBackground(AmmoToRemove, RemoveAmmo);
                }

                if (!WeaponAmmoPullQueue.IsEmpty && ITask.IsComplete)
                {
                    if (ITask.valid && ITask.Exceptions != null)
                    {
                        TaskHasErrors(ref ITask, "ITask");
                    }

                    ITask = MyAPIGateway.Parallel.StartBackground(AmmoPull, MoveAmmo);
                }

                if (!CompsToStart.IsEmpty)
                {
                    StartComps();
                }

                if (Tick120 && CompsDelayed.Count > 0)
                {
                    DelayedComps();
                }

                if (CompReAdds.Count > 0)
                {
                    ChangeReAdds();
                }

                if (Tick3600 && MpActive)
                {
                    NetReport();
                }

                if (Tick180)
                {
                    ProfilePerformance();
                }

                FutureEvents.Tick(Tick);

                if (!DedicatedServer && ActiveControlBlock != null && !InMenu)
                {
                    WheelUi.UpdatePosition();
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }
Beispiel #2
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                if (SuppressWc)
                {
                    return;
                }

                if (DeformProtection.Count > 0 && Tick - LastDeform > 0)
                {
                    DeformProtection.Clear();
                }

                Timings();

                if (IsClient)
                {
                    if (ClientSideErrorPkt.Count > 0)
                    {
                        ReproccessClientErrorPackets();
                    }

                    if (ClientPacketsToClean.Count > 0)
                    {
                        CleanClientPackets();
                    }
                }

                if (IsServer)
                {
                    if (Tick60)
                    {
                        AcqManager.Observer();
                    }
                    if (Tick600)
                    {
                        AcqManager.ReorderSleep();
                    }
                }

                if (!DedicatedServer && TerminalMon.Active)
                {
                    TerminalMon.Monitor();
                }

                MyCubeBlock cube;
                if (Tick60 && UiInput.ControlKeyPressed && UiInput.CtrlPressed && GetAimedAtBlock(out cube) && cube.BlockDefinition != null && WeaponCoreBlockDefs.ContainsKey(cube.BlockDefinition.Id.SubtypeName))
                {
                    ProblemRep.GenerateReport(cube);
                }

                if (!IsClient && !InventoryUpdate && WeaponToPullAmmo.Count > 0 && ITask.IsComplete)
                {
                    StartAmmoTask();
                }

                if (!CompsToStart.IsEmpty)
                {
                    StartComps();
                }

                if (Tick120 && CompsDelayed.Count > 0)
                {
                    DelayedComps();
                }

                if (Tick20 && !DelayedAiClean.IsEmpty)
                {
                    DelayedAiCleanup();
                }

                if (CompReAdds.Count > 0)
                {
                    ChangeReAdds();
                }

                if (Tick3600 && MpActive)
                {
                    NetReport();
                }

                if (Tick180)
                {
                    ProfilePerformance();
                }

                FutureEvents.Tick(Tick);

                if (HomingWeapons.Count > 0)
                {
                    UpdateHomingWeapons();
                }


                if (MpActive)
                {
                    if (PacketsToClient.Count > 0 || PrunedPacketsToClient.Count > 0)
                    {
                        ProccessServerPacketsForClients();
                    }
                    if (PacketsToServer.Count > 0)
                    {
                        ProccessClientPacketsForServer();
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }
Beispiel #3
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);

                Timings();

                if (!WeaponAmmoRemoveQueue.IsEmpty && CTask.IsComplete)
                {
                    if (CTask.valid && CTask.Exceptions != null)
                    {
                        TaskHasErrors(ref CTask, "CTask");
                    }

                    CTask = MyAPIGateway.Parallel.StartBackground(AmmoToRemove, RemoveAmmo);
                }

                if (!WeaponAmmoPullQueue.IsEmpty && ITask.IsComplete)
                {
                    if (ITask.valid && ITask.Exceptions != null)
                    {
                        TaskHasErrors(ref ITask, "ITask");
                    }

                    ITask = MyAPIGateway.Parallel.StartBackground(AmmoPull, MoveAmmo);
                }

                if (!CompsToStart.IsEmpty)
                {
                    StartComps();
                }

                if (Tick120 && CompsDelayed.Count > 0)
                {
                    DelayedComps();
                }

                if (CompReAdds.Count > 0)
                {
                    ChangeReAdds();
                }

                if (Tick3600 && MpActive)
                {
                    NetReport();
                }

                if (Tick180)
                {
                    ProfilePerformance();
                }

                FutureEvents.Tick(Tick);

                if (!DedicatedServer && UiInput.PlayerCamera && !InMenu)
                {
                    WheelUi.UpdatePosition();
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }