Closed siimav closed 2 years ago
This seems questionable. Some of the checks don't apply for already accepted contracts, but some DO. So just checking the state I'd not going to do it.
The cooldownDuration check seems okay at a glance, but it's been a long while since I've looked at this stuff.
At least for maxSimultaneous
I think the player shouldn't be able to accept more instances than the limit so why check that for already accepted contracts?
As for maxCompletions
- I guess checking this for active contracts can be necessary when maxSimultaneous
is also > 1
at the same time? This way if you complete an instance and reach the maxCompletions
value then all the others will fail?
CheckContractGroup
is for disabling and enabling contracts groups through the stock difficulty settings menu. Here I don't think it's necessary to automatically fail contracts from groups that got disabled.
Edit: oops, I missed the fact that CheckContractGroup
also has maxSimultaneous
and maxCompletions
checks. :/
I have revised the PR with the changes I mentioned in the previous comment. At least for the contracts in RP-1 this should mostly eliminate the need to run those Linq queries.
KSP will run them in a coroutine for every Update in the flight scene. Some of the checks aren't relevant at all for already accepted contracts.