Exemple #1
0
        public MLanceOverride GetLanceOverride(string key)
        {
            IDataItemStore <string, LanceDef> lanceDefs = UnityGameInstance.BattleTechGame.DataManager.LanceDefs;

            if (LanceOverrides.ContainsKey(key))
            {
                Main.Logger.Log($"[GetLanceOverride] Found a lance override for '{key}'");
                return(LanceOverrides[key].Copy());
            }

            LanceDef lanceDef = null;

            lanceDefs.TryGet(key, out lanceDef);
            if (lanceDef != null)
            {
                MLanceOverride lanceOverride = new MLanceOverride(lanceDef);
                LanceOverrides.Add(lanceOverride.lanceDefId, lanceOverride);
                Main.Logger.Log($"[GetLanceOverride] Found a lance def for '{key}', creating and caching a lance override for it. Using defaults of 'adjustedDifficulty' of '0' and no 'spawnEffectTags'");
                return(lanceOverride.Copy());
            }
            else
            {
                Main.Logger.Log($"[GetLanceOverride] No loaded LanceDef was found for '{key}'. Attempting to load the LanceDef.");
                lanceDef = BattleTechResourceLoader.LoadDefFromId <LanceDef>(key, BattleTechResourceType.LanceDef);
                DataManager.Instance.RequestResourcesAndProcess(BattleTechResourceType.LanceDef, key);

                if (lanceDef != null)
                {
                    MLanceOverride lanceOverride = new MLanceOverride(lanceDef);
                    LanceOverrides.Add(lanceOverride.lanceDefId, lanceOverride);
                    Main.Logger.Log($"[GetLanceOverride] Load succeeded. Found a lance def for '{key}', creating and caching a lance override for it. Using defaults of 'adjustedDifficulty' of '0' and no 'spawnEffectTags'");
                    return(lanceOverride.Copy());
                }
            }

            Main.Logger.LogError($"[GetLanceOverride] No MC Lance or LanceDef found with key '{key}'. This is a case sensitive search.'");
            return(null);
        }
Exemple #2
0
        public MLanceOverride GetLanceOverride(string key)
        {
            IDataItemStore <string, LanceDef> lanceDefs = UnityGameInstance.BattleTechGame.DataManager.LanceDefs;

            if (LanceOverrides.ContainsKey(key))
            {
                Main.Logger.Log($"[GetLanceOverride] Found a lance override for '{key}'");
                return(LanceOverrides[key]);
            }

            LanceDef lanceDef = null;

            lanceDefs.TryGet(key, out lanceDef);
            if (lanceDef != null)
            {
                MLanceOverride lanceOverride = new MLanceOverride(lanceDef);
                LanceOverrides.Add(lanceOverride.lanceDefId, lanceOverride);
                Main.Logger.Log($"[GetLanceOverride] Found a lance def for '{key}', creating and caching a lance override for it. Using defaults of 'adjustedDifficulty - 0' and no 'spawnEffectTags'");
                return(lanceOverride);
            }

            return(null);
        }
Exemple #3
0
        static void Rehydrate_Pre(SimGameState __instance, GameInstanceSave gameInstanceSave)
        {
            IDataItemStore <string, ContractOverride> contractOverrides = __instance.DataManager.ContractOverrides;

            gameInstanceSave.SimGameSave.ContractBits.RemoveAll(item => !contractOverrides.Exists(item.conName));
        }