The more I looked the code, in many versions, the more I'm sure the objective is quick code to be able to give stuff to patreons each month at fixed date, there are many examples like the code you quote in the game, and I'm pretty sure he don't have enough time to really play the game.
I just hope all this won't finish on a burn out before the mechanics are finalized.
I guess it might not be laziness as I stated above but poor forethought is definitely at play no matter how you look at it.
If we assume you are correct and he doesn't change it this game will end as a steaming pile of shit that isn't playable at the rate he is going.
He created everything for the most part he needs to do what I suggested above. He just didn't do it.
He has all the traits as an object with all the attached variables.
He created a list even containing all of them. They are even ordered in order of Tier 0 up.
So you know 0 to 10 are tier 0 traits.
It would have been better if the base and high capacity were put in a separate list.
Either way. It can still be used as I said in the prior post. if random comes up 1 then add its stuff and increase slots by 2 for 2 new traits.
0 - 10 tier 0
11 - 29 tier 1
30 - 46 tier 2
47 - 51 tier 3
52 - 55 Nora
Make a few added lists
Serum_Bases = [0,11,30,47]
Serum_HC = 1
Max_Trait [10,29,46,51,55] #used to tell the max level a trait can pull from per production level
Use that to set the max random value (2,Max_Trait)
If it happens to come up one of the bases reroll.
Also role a separate role to see if high cap is used first.
I went ahead and did this.
https://f95zone.to/threads/lab-rats-2-mods.32881/post-7119138
That's the modded file.
The other option is he has to generate a table at the start of the game based on the traits.
The table would include the maximum levels that can be achieved in the various combinations and he would need to ensure any random value he selected is below the max or the serum would be impossible to produce.
That's actually a lot more complex. Because any selection you make as a trait is going to limit the other areas of traits. Because you only have so many slots. Example: if you select a trait that has 0 med. It then limits the serums max med level because that slot is used. Same goes for sex, physical and so on.
Though what I proposed above is vastly better than what he did it is still a poor solution in my book. Unless the player is near completing all of his research in a level there is a good chance he won't be able to fill any contracts for half of the time in that level.
There isn't really a good way to fix this because of what he chose to base around.
There are other issues with the system. Such as in the early game the contracts also prevent you from running anything else for a period of time to fill them. So doing work on stuff you need to or should be working on is put on the back burner to fill a contract. You don't have the money to hire enough staff early on and run more than one line.
The market system for this contract is entirely backwards of what it would be in reality in a lot of aspects.
There probably isn't a large number of companies producing the same thing. So this would be more of a situation of you advertise the product and people wanting it bid on it because there is a limited availability.
Special contracts could ensue if someone wanted some sort of change to the product. That's more how this would work in the real world. Your sales department would most likely need to travel outside the office pedaling it like actual pharma sells reps do in real life.
But I do understand why he didn't base it on reality for this game purpose. He was trying to make money harder to get.
He went about it the wrong way. He could have limited a lot better if he used a more realistic and complex research system like the one I suggested in the past. One were you hire women and sponsor expeditions and so on to find items that process properties to created the desired traits. They could loose money on expedition even staff. What they return with may not be as good as they hoped and only have a very mild effect instead were some other item may have a much greater effect.
The best part is this can be randomized for every game so each time you replay the game its is different and you can just min max the game by remembering all the good items vs all the bad items.
So as long as he keeps it this way its going to be poor to mediocre at best. That's even if he fixes it to what I suggested basing it on actual producible serums and not pure random as he has.