/** * Used to scale the Drag Curves. * * Use absolute = true when you are sure KSP had reset the DragCurves to the default and need to scale them backl. */ protected override void ScaleDragCubes(bool absolute) { base.ScaleDragCubes(absolute); ScalingFactor.FactorSet factor = absolute ? this.ts.ScalingFactor.absolute : this.ts.ScalingFactor.relative ; if (factor.linear == 1) { return; } int len = this.part.DragCubes.Cubes.Count; for (int ic = 0; ic < len; ic++) { DragCube dragCube = this.part.DragCubes.Cubes[ic]; dragCube.Size *= factor.linear; for (int i = 0; i < dragCube.Area.Length; i++) { dragCube.Area[i] *= factor.quadratic; } for (int i = 0; i < dragCube.Depth.Length; i++) { dragCube.Depth[i] *= factor.linear; } } this.part.DragCubes.ForceUpdate(true, true); }
/** * Used to reset and scale the Drag Curves. * * To be used when you don't know the state of the Drag Curves, but yet needs to be sure to have them scaled to the current factor */ protected override void RescaleDragCubes() { base.RescaleDragCubes(); ScalingFactor.FactorSet factor = this.ts.ScalingFactor.absolute; // Rescaling it's always absolute! int len = this.part.DragCubes.Cubes.Count; for (int i = 0; i < len; ++i) { DragCube part = this.part.DragCubes.Cubes[i]; DragCube prefab = this.prefab.DragCubes.Cubes[i]; part.Size = prefab.Size; for (int j = 0; j < part.Area.Length; ++j) { part.Area[j] = prefab.Area[j]; } for (int j = 0; j < part.Depth.Length; ++i) { part.Depth[j] = prefab.Depth[j]; } } if (factor.linear == 1) { return; } for (int ic = 0; ic < len; ic++) { DragCube dragCube = this.part.DragCubes.Cubes[ic]; dragCube.Size *= factor.linear; for (int i = 0; i < dragCube.Area.Length; i++) { dragCube.Area[i] *= factor.quadratic; } for (int i = 0; i < dragCube.Depth.Length; i++) { dragCube.Depth[i] *= factor.linear; } } this.part.DragCubes.ForceUpdate(true, true); }