Ejemplo n.º 1
0
        public override void PostLoad()
        {
            if (modID == null || !ModUtil.IsActive(ModID))
            {
                Log.Error($"modID '{modID.ToStringSafe()}' isn't valid, {defName} won't be registered!");
                return;
            }

            ScribeCompatUtility.RegisterBackCompatibilityDef(this);
        }
Ejemplo n.º 2
0
        public static void PrepareForSaving()
        {
            compatibilityEntries.RemoveAll(d => !ModUtil.IsActive(d.ModID));

            foreach (var entry in compatibilityEntries)
            {
                entry.CompatsInstalled.RemoveAll(e => !defDatabase.Any(t => t.defName == e));
            }

            compatibilityEntries.RemoveAll(e => e.CompatsInstalled.Count == 0);

            var remainingModIDs = compatibilityEntries.Select(d => d.ModID).ToHashSet();

            foreach (var def in defDatabase)
            {
                if (!SaveHasModID(def.ModID) && !remainingModIDs.Contains(def.ModID))
                {
                    InstalledCompatability(def);
                }
            }
        }
Ejemplo n.º 3
0
        public static void ExposeCompatibilityList()
        {
            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                isLoadedGame = true;

                saveModIDsHash = ScribeMetaHeaderUtility.loadedModIdsList.Select(s => s.StripModID()).Where(m => ModUtil.IsActive(m)).ToHashSet();
            }

            if (Scribe.mode == LoadSaveMode.Saving)
            {
                PrepareForSaving();
            }

            if (Scribe.EnterNode("modBackCompatibility"))
            {
                try
                {
                    Scribe_Collections.Look(ref compatibilityEntries, "installed", LookMode.Deep);
                }
                finally
                {
                    Scribe.ExitNode();
                }
            }
            else if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                compatibilityEntries.Clear();
            }
        }