public BuildListVessel CreateCopy(bool RecalcTime) { BuildListVessel ret = new BuildListVessel(ShipName, LaunchSite, EffectiveCost, BuildPoints, IntegrationPoints, Flag, Cost, IntegrationCost, (int)GetEditorFacility()) { ShipNode = ShipNode.CreateCopy() }; //refresh all inventory parts to new foreach (var p in ret.ExtractedPartNodes) { ScrapYardWrapper.RefreshPart(p); } ret.Id = Guid.NewGuid(); ret.KCTPersistentID = Guid.NewGuid().ToString(); ret.TotalMass = TotalMass; ret.EmptyMass = EmptyMass; ret.Cost = Cost; ret.IntegrationCost = IntegrationCost; ret.EmptyCost = EmptyCost; ret.NumStageParts = NumStageParts; ret.NumStages = NumStages; ret.StagePartCost = StagePartCost; ret.ShipSize = ShipSize; if (RecalcTime) { ret.EffectiveCost = Utilities.GetEffectiveCost(ret.ExtractedPartNodes); ret.BuildPoints = Utilities.GetBuildTime(ret.EffectiveCost); ret.IntegrationPoints = MathParser.ParseIntegrationTimeFormula(ret); ret.IntegrationCost = (float)MathParser.ParseIntegrationCostFormula(ret); } return(ret); }
public KCT_BuildListVessel NewCopy(bool RecalcTime) { KCT_BuildListVessel ret = new KCT_BuildListVessel(this.shipName, this.launchSite, this.buildPoints, this.flag, this.cost, (int)GetEditorFacility()); ret.shipNode = this.shipNode.CreateCopy(); //refresh all inventory parts to new for (int i = ret.ExtractedPartNodes.Count - 1; i >= 0; i--) { ConfigNode part = ret.ExtractedPartNodes[i]; //foreach (ConfigNode part in ret.ExtractedPartNodes) //{ ScrapYardWrapper.RefreshPart(part); } ret.id = Guid.NewGuid(); if (RecalcTime) { ret.buildPoints = KCT_Utilities.GetBuildTime(ret.ExtractedPartNodes); } ret.TotalMass = this.TotalMass; ret.emptyMass = this.emptyMass; ret.cost = this.cost; ret.emptyCost = this.emptyCost; ret.numStageParts = this.numStageParts; ret.numStages = this.numStages; ret.stagePartCost = this.stagePartCost; return(ret); }