So in order to protect the progression in both ways, to keep the mission order moving along a progression, while keeping it from being too difficult randomly, I believe it's best to use Contract Configurator's Persistent Data Store feature. However, I'm uncertain that I know how it works, and I'm uncertain that even if I am using it correctly, I'm using it with the proper code efficiency.
Why are we using PDS instead of DATA nodes? Because I want contract a to be able to unlock contract b, and DATA nodes are specific to each contract .CFG file.
To start, I'll quote the above linked section from the CC Wiki.
Contract Configurator contains a persistant data store that may be used by extension modules. This is intended for storing values that need to be tracked across different contracts. To store data for a parameter, store it using the OnLoad/OnSave functions of the ContractParameter class. To store data for a contract, store it using the OnLoad/OnSave functions of a ContractBehaviour class.
The persistant data store is access by calling one of the two following methods on PersistantDataStore.Instance:
void Store(string key, T value) - This will store the value under the given key. Try to make the key include a prefix for your module to ensure that it unique across all possible Contract Configurator modules.
T Retrieve(string key) - This will retrieve a previously stored value.
So how do we use this in Exodus? Starting at the beginning, we have to initialize the data store, presumably in Exodus.cfg's CONTRACT_GROUPs, like this:
... stuff you can see on GitHub ...
CONTRACT_GROUP
{
name = ExodusStory
displayName = Exodus Story Contracts
ContractBehaviour
{
void OnLoad = A1, A2, A3
}
}
CONTRACT_GROUP
{
name = ExodusDisaster
displayName = Exodus Disaster Contracts
ContractBehaviour
{
void OnLoad = B1, B2, B3
}
}
... stuff ...
What we want here is to generate 3 data stores (lists/arrays/whatever) that can store various bodies. In ExodusStory they pertain to Orbited, Station Built, and Base respectively. In Exodus Disaster they similarly refer to Satellites, Stations, & Bases.
What does this let me supposedly do?
Starting at the beginning with the initial doom-confirming Kerbin orbital mission, A1 & all the rest should be empty. When the player completes the mission, the mission file with execute these snippets:
CONTRACT_TYPE
{
.... the rest of the contract stuff ....
CONTRACT_COMPLETED_SUCCESS
{
void Store<A1>(EX01,Mun)
void Store<A1>(EX02,Minmus)
}
}
What does it do? By itself, nothing, of course. But if we add to the Orbitals.CFG mission file that determines all other pre-station orbital missions:
... stuff ...
DATA
{
targetbody1 = void A1 Retrieve<A1>(Random)
}
... stuff ...
Then the orbitals mission should retrieve a target body value from A1 -- currently EX001 or EX002 (Mun or Minmus) that the player is expected to currently be capable of reaching.
Then, the Orbitals.CFG config file should also include:
CONTRACT_TYPE
{
.... the rest of the contract stuff ....
CONTRACT_COMPLETED_SUCCESS
{
void Store<A2>(EX01,Mun)
void Store<A2>(EX02,Minmus)
}
}
Then we can move on to the stations where it should list:
... stuff ...
DATA
{
targetbody1 = void A2 Retrieve<A2>(Random)
}
... stuff ...
As you can see, the PDS is being used to unlock mission types via location. Bases will unlock further locations, where the Orbital > Station > Base main tree will repeat.
However, this will tree to a point. Bases & stations both unlock random missions of both the disaster & science lists (B1 & B2, C1 & C2); as well as RemoteTech missions (C1, C2, C3; B3, C3) that can also serve as story mission prerequisites.
So why did I post this....?
Well I have no clue as to whether this should work. As you can see from my quote at the top, there's very little explanation & very few examples given as to how PDS can/will work. So I could be entirely wrong as to how I can implement this feature, or as to my basic logic surrounding how I wish to use this.
Hence, I'd like some input from the many coders on the forum.