Exemple #1
0
        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());
        }
Exemple #2
0
 private TLMAssetConfiguration SafeGetAsset(string assetName)
 {
     if (!AssetConfigurations.ContainsKey(assetName))
     {
         AssetConfigurations[assetName] = new TLMAssetConfiguration();
     }
     return(AssetConfigurations[assetName]);
 }
Exemple #3
0
 public bool IsCustomCapacity(string name) => AssetConfigurations.ContainsKey(name);