private void InitCapacitiesInAssets() { var keys = AssetConfigurations.Keys.ToList(); foreach (string entry in keys) { try { VehicleInfo info = PrefabCollection <VehicleInfo> .FindLoaded(entry); if (info != null) { VehicleAI ai = info.m_vehicleAI; UpdateDefaultCapacity(ai); SetVehicleCapacity(ai, SafeGetAsset(entry).Capacity); } else { AssetConfigurations.Remove(entry); } } catch (Exception e) { LogUtils.DoErrorLog($"ERROR LOADING ASSET CONFIG: {e}=> {e.Message}\n{e.StackTrace}"); } } SimulationManager.instance.StartCoroutine(TLMVehicleUtils.UpdateCapacityUnitsFromTSD()); }
private TLMAssetConfiguration SafeGetAsset(string assetName) { if (!AssetConfigurations.ContainsKey(assetName)) { AssetConfigurations[assetName] = new TLMAssetConfiguration(); } return(AssetConfigurations[assetName]); }
public bool IsCustomCapacity(string name) => AssetConfigurations.ContainsKey(name);