diff --git a/source/GameInterface/Services/MapEvents/MapEventRegistry.cs b/source/GameInterface/Services/MapEvents/MapEventRegistry.cs index e2cba96b1..31637122c 100644 --- a/source/GameInterface/Services/MapEvents/MapEventRegistry.cs +++ b/source/GameInterface/Services/MapEvents/MapEventRegistry.cs @@ -1,7 +1,10 @@ using GameInterface.Registry; +using System.Diagnostics.Metrics; using System.Threading; using TaleWorlds.CampaignSystem; using TaleWorlds.CampaignSystem.MapEvents; +using TaleWorlds.CampaignSystem.Settlements.Buildings; +using TaleWorlds.CampaignSystem.Settlements; namespace GameInterface.Services.MapEvents; @@ -17,9 +20,12 @@ public MapEventRegistry(IRegistryCollection collection) : base(collection) { } public override void RegisterAll() { + int counter = 0; + foreach (var mapEvent in Campaign.Current.MapEventManager.MapEvents) { - if (RegisterExistingObject(mapEvent.StringId, mapEvent) == false) + var networkId = nameof(Building) + "_" + "Coop" + counter++; + if (RegisterExistingObject(networkId, mapEvent) == false) { Logger.Error($"Unable to register {mapEvent}"); }