Пример #1
0
        void IModBase.WorldExit()
        {
            try
            {
                OnWorldExit?.Invoke();

                for (int i = 0; i < Components.Count; ++i)
                {
                    try
                    {
                        Components[i].UnregisterComponent();
                    }
                    catch (Exception e)
                    {
                        Log.Error($"Exception during {Components[i].GetType().Name}.UnregisterComponent(): {e.Message}", Log.PRINT_MESSAGE);
                        Log.Error(e);
                    }
                }

                Components.Clear();
                ComponentRefreshFlags.Clear();
                ComponentUpdateInput.Clear();
                ComponentUpdateBeforeSim.Clear();
                ComponentUpdateAfterSim.Clear();
                ComponentUpdateDraw.Clear();
            }
            finally
            {
                Session  = null;
                Instance = null;
            }
        }
Пример #2
0
        protected ModBase(string modName, PaintGun_GameSession session)
        {
            Log.ModName       = modName;
            Log.AutoClose     = false;
            IsServer          = MyAPIGateway.Multiplayer.IsServer;
            IsDedicatedServer = (IsServer && MyAPIGateway.Utilities.IsDedicated);
            IsPlayer          = !IsDedicatedServer;

            Session  = session;
            Instance = (TModMain)(IModBase)this;
        }