This is needed for mods that add tasks to standard maps, but also mods
that add custom maps: because their custom netobjects don't get
registered Impostor thinks people are still on the old map when people
switch to the custom map after playing a game.
var taskId = 0u;
foreach (var taskTypeId in taskTypeIds.Span)
{
- player.Tasks.Add(new TaskInfo(
- player,
- _eventManager,
- taskId++,
- Game.GameNet!.ShipStatus?.Data.Tasks[taskTypeId]
- ));
+ var mapTasks = Game.GameNet!.ShipStatus?.Data.Tasks;
+ var taskType = mapTasks?.ContainsKey(taskTypeId) ?? false ? mapTasks[taskTypeId] : null;
+ player.Tasks.Add(new TaskInfo(player, _eventManager, taskId++, taskType));
}
}
}