From: miniduikboot Date: Wed, 25 May 2022 17:53:32 +0000 (+0200) Subject: Allow adding custom tasks on standard maps (#481) X-Git-Tag: v1.7.0~5 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=224fdd1d5b29a12b669b7619ca947c28c0288b2c;p=rhonda%2Fimpostor.git Allow adding custom tasks on standard maps (#481) 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. --- diff --git a/src/Impostor.Server/Net/Inner/Objects/InnerGameData.cs b/src/Impostor.Server/Net/Inner/Objects/InnerGameData.cs index 4510729..835ddc5 100644 --- a/src/Impostor.Server/Net/Inner/Objects/InnerGameData.cs +++ b/src/Impostor.Server/Net/Inner/Objects/InnerGameData.cs @@ -140,12 +140,9 @@ namespace Impostor.Server.Net.Inner.Objects 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)); } } }