Skip to content

Commit

Permalink
don't save empty record in asset editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Oct 16, 2022
1 parent c7d6f4a commit c7f189c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TLM/TLM/Lifecycle/AssetDataExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void OnAssetSavedImpl(string name, object asset, out Dictionary<st
Log.Info("AssetDataExtension.OnAssetSavedImpl(): prefab is " + prefab);
var assetData = AssetData.GetAssetData(prefab);
if (assetData == null) {
Log._Debug("AssetDataExtension.OnAssetSavedImpl(): No segments to record.");
Log._Debug("AssetDataExtension.OnAssetSavedImpl(): Nothing to record.");
} else {
Log._Debug("AssetDataExtension.OnAssetSavedImpl(): assetData=" + assetData);
userData = new Dictionary<string, byte[]>();
Expand Down
2 changes: 0 additions & 2 deletions TLM/TLM/Manager/Impl/TrafficLightManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ namespace TrafficManager.Manager.Impl {
using ColossalFramework;
using TrafficManager.TrafficLight.Impl;
using TrafficManager.API.Traffic.Data;
using static EconomyManager;
using UnityEngine.Networking.Types;

/// <summary>
/// Manages traffic light toggling
Expand Down
8 changes: 6 additions & 2 deletions TLM/TLM/State/Asset/AssetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ public static AssetData GetAssetData(BuildingInfo prefab) {
if (!HasPaths(prefab)) {
return null;
}

var record = RecordAll();
if (record == null || record.IsDefault()) {
return null;
}

return new AssetData {
Version = VersionUtil.ModVersion,
Record = RecordAll(),
Record = record,
PathNetworkIDs = GetPathsNetworkIDs(prefab),
};
}
Expand Down

0 comments on commit c7f189c

Please sign in to comment.