You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be a lot less work than adding part upgrades when the desired prerequisite is merely the tech being researched
Here is the draft code for your consideration, mostly copied from the existing PartUpgrade feature. It contains two additional fields and two inserts to existing methods
#region Config Fields
[NodeData]
public string techRequired;
#endregion
#region Private Fields
public bool HasTechRequired => !techRequired.IsNullOrEmpty();
#endregion
#region Setup
private void OnLoad(ConfigNode node, OperationContext context)
{
if (HasTechRequired && !AssetBase.RnDTechTree.GetTreeTechs().Any(t => t.techID == techRequired))
{
SeriousWarningHandler.DisplaySeriousWarning($"Tech node does not exist: {techRequired} on: {this}");
LogError("Tech node does not exist: " + techRequired);
techRequired = null;
}
}
#endregion
#region Public Methods
public bool IsUnlocked()
{
if (!HasUpgradeRequired && !HasTechRequired) return true;
if (HighLogic.CurrentGame.IsNull()) return true;
if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX) return true;
bool isUnlocked = true;
if (HasUpgradeRequired)
isUnlocked = PartUpgradeManager.Handler.IsUnlocked(upgradeRequired);
if (HasTechRequired)
isUnlocked = isUnlocked && ResearchAndDevelopment.Instance.GetTechState(techRequired) != null;
return isUnlocked;
}
#endregion
The text was updated successfully, but these errors were encountered:
This would be a lot less work than adding part upgrades when the desired prerequisite is merely the tech being researched
Here is the draft code for your consideration, mostly copied from the existing PartUpgrade feature. It contains two additional fields and two inserts to existing methods
The text was updated successfully, but these errors were encountered: