public bool DoesLanceOverrideExist(string key) { if (LanceOverrides.ContainsKey(key)) { return(true); } if (UnityGameInstance.BattleTechGame.DataManager.LanceDefs.Exists(key)) { return(true); } return(LoadDirectLanceReference(key)); }
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); }
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); }