Repository navigation
Description
Problem
On master 5899d09, the contract block profile declares MinContracts and MaxContracts, sets both to 10 by default and parses them, but nothing reads them. ApplyProfileToBlock goes through every entry in MissionIds and tries to post each one:
Lines 110 to 128 in 5899d09
| for (int i = 0; i < MissionIds.Count; i++) | |
| { | |
| MissionProfile missionprofile = null; | |
| if (!ProfileManager.MissionProfiles.TryGetValue(MissionIds[i], out missionprofile)) | |
| { | |
| BehaviorLogger.Write(ProfileSubtypeId + ": Couldn't find Mission Profile With Name: " + MissionIds[i], BehaviorDebugEnum.Action); | |
| continue; | |
| } | |
| var mission = new Mission(MissionIds[i], npcData); | |
| if (!mission.Init(block)) | |
| { | |
| //MyVisualScriptLogicProvider.ShowNotificationToAll($"Failed {MissionIds[i]}", 5000); | |
| } | |
So a profile with six mission ids and [MinContracts:2] [MaxContracts:3] still posts all six. Searching the code and the wiki docs for both names only finds the declaration, the defaults and the tag parsing. They have been there since alpha v1 (July 2024).
Fix
Before the loop, pick how many contracts to post, a random number from MinContracts to MaxContracts limited to the number of mission ids, and post that many of the ids, picked at random. MinTime and MaxTime in the chat profile are used the same way:
Line 195 in 5899d09
| SecondsUntilChat = Rnd.Next(MinTime, MaxTime); |
The default of 10 would then cap profiles that list more than 10 ids. If that is a problem the defaults could change to a value that means no limit. If you would rather not support the tags, removing them is the other option.
Happy to open a PR for this.
Activity
enenra commentedon Oct 19, 2026
We'll hold with this one for now as I've got some larger changes incoming to anything involving contracts and missions that I want to put through first.