Issue #27622: Brahmin creation issue
Brahmin creation is handled by a block of code in the DailyUpdateAttractNewSettlers() function of WorkshopScript:
if newWorkshopActor.GetValue(WorkshopParent.WorkshopGuardPreference) == 0 if GetValue(ratings[WorkshopParent.WorkshopRatingBrahmin].resourceValue) == 0.0 && AllowBrahminRecruitment int brahminRoll = utility.RandomInt() if brahminRoll <= WorkshopParent.recruitmentBrahminChance actor newBrahmin = WorkshopParent.CreateActor_DailyUpdate(self, bBrahmin = true) endif endif endif
Any time a settler is created that is not a guard, the script may roll for creating a brahmin IF the brahmin resource rating value for the workshop is zero (i.e. if there is no brahmin at the workshop yet) [NB: we can disregard the AllowBrahminRecruitment bool in this context: this is a const property on WorkshopScript and will not change during the game. For mosts worksops, this is permanently 'true'].
Since a brahmin will increase the respective workshop rating by 1.0, it was clearly not intended to create more than one free brahmin. In practice however, the scripts may create any number of free brahmins: in my current playthrough, I got half a dozen at Hangman's Alley and they severely clogged up the whole workshop. This is because of a flaw in the procedure: to update the workshop ratings, a workshop resource recalculation needs to be carried out but this is not done if a workshop is not loaded (because many resource rating values depend on cell data and these would all turn to zero if the resource recalculation was run on an unloaded workshop). Thus, the brahmin resource rating stays at zero until the workshop loads for the next time, no matter how many brahmins are created in the meantime.
To fix this, the brahmin resource rating needs to be modified 'manually' whenever a brahmin is added to a workshop. This code is in the AddActorToWorkshop() function of WorkshopParentScript.