/// <summary>Updates the PAW with scaleFactor and advises KSP that the ship has changed</summary> /// <summary> /// <para> /// Called when [rescale]. /// </para> /// </summary> /// <param name="scaleFactor">The scale factor.</param> internal void OnRescale(TweakScale.ScalingFactor.FactorSet scaleFactor) { Log.dbg("scaleFactor: {0}", scaleFactor.quadratic); /// <summary>this scales any resources on the part with ODFC: </summary> foreach (PartResource resource in this.part.Resources) { Log.dbg("unscaled resource: {0}: {1} / {2}", resource.resourceName, resource.amount, resource.maxAmount); resource.maxAmount *= scaleFactor.quadratic; // .cubic; resource.amount *= scaleFactor.quadratic; // cubic; Log.dbg("scaled resource: {0}: {1} / {2}", resource.resourceName, resource.amount, resource.maxAmount); } /// <summary><para> /// this scales the actual fuel cell, fuels, byproducts, and maxEC /// shouldn't scale rateLimit and threshold because are percentages ///</para></summary> for (int m = 0; m <= ODFC_config.modes.Length - 1; m++) { Log.dbg("mode/modes: {0} / {1}", (m + 1), ODFC_config.modes.Length); // scale MaxEC Log.dbg("unscaled maxEC: {0}", ODFC_config.modes[m].maxEC); ODFC_config.modes[m].maxEC *= scaleFactor.quadratic; Log.dbg("scaled maxEC: {0}", ODFC_config.modes[m].maxEC); // scale fuels in ODFC_config.modes Log.dbg("Fuels in mode: {0} / {1}", (m + 1), ODFC_config.modes[m].fuels.Length + 1); for (int n = 0; n <= ODFC_config.modes[m].fuels.Length - 1; n++) { //Log.dbg("unscaled Fuel: {0} = {1}", PartResourceLibrary.Instance.GetDefinition(ODFC_config.modes[m + 1].fuels[n + 1].resourceID).name, ODFC_config.modes[m + 1].fuels[n + 1].rate); ODFC_config.modes[m].fuels[n].rate *= scaleFactor.quadratic; //Log.dbg("scaled Fuel: {0} = {1}" + PartResourceLibrary.Instance.GetDefinition(ODFC_config.modes[m + 1].fuels[n + 1].resourceID).name, ODFC_config.modes[m + 1].fuels[n + 1].rate); } // scale byproducts in ODFC_config.modes Log.dbg("Byproducts in mode: {0} / {1}", (m + 1), ODFC_config.modes[m].byproducts.Length + 1); for (int n = 0; n <= ODFC_config.modes[m].byproducts.Length - 1; n++) { //Log.dbg("unscaled byproduct: {0} = {1}", PartResourceLibrary.Instance.GetDefinition(ODFC_config.modes[m].byproducts[n + 1].resourceID).name, ODFC_config.modes[m + 1].byproducts[n + 1].rate); ODFC_config.modes[m].byproducts[n].rate *= scaleFactor.quadratic; //Log.dbg("scaled byproduct: {0} / {1}", PartResourceLibrary.Instance.GetDefinition(ODFC_config.modes[m].byproducts[n + 1].resourceID).name, ODFC_config.modes[m + 1].byproducts[n + 1].rate); } } updateEditor(); // updateFuelTexts(); // removed.this }
/// <summary>Updates the PAW with scaleFactor and advises KSP that the ship has changed</summary> /// <summary> <para> Called when [rescale].</para> </summary> /// <param name="scaleFactor">The scale factor.</param> internal void OnRescale(TweakScale.ScalingFactor.FactorSet scaleFactor) { // Log.Info(String.Format("scaleFactor: {0}:{1}", scaleFactor.ToString(), scaleFactor.quadratic)); /// <summary>this scales any resources on the part with ODFC: </summary> foreach (PartResource resource in this.part.Resources) { // Log.Info(String.Format("unscaled resource: {0}: {1} / {2}", resource.resourceName, resource.amount, resource.maxAmount)); resource.maxAmount *= scaleFactor.quadratic; // .cubic; resource.amount *= scaleFactor.quadratic; // cubic; // Log.Info(String.Format("scaled resource: {0}: {1} / {2}", resource.resourceName, resource.amount, resource.maxAmount)); } /// <summary><para> this scales the actual fuel cell, fuels, byproducts, and maxEC /// shouldn't scale rateLimit and threshold because are percentages </para></summary> for (int m = 0; m <= ODFC_config.modes.Length - 1; m++) { // Log.Info(String.Format("mode/modes: {0} / {1}", (m + 1), ODFC_config.modes.Length)); // Log.Info(String.Format("unscaled maxEC: {0}", ODFC_config.modes[m].maxEC)); //? scale MaxEC ODFC_config.modes[m].maxEC *= scaleFactor.quadratic; // Log.Info(String.Format("scaled maxEC: {0}", ODFC_config.modes[m].maxEC)); // Log.Info(String.Format("Fuels in mode: {0} / {1}", (m + 1), ODFC_config.modes[m].fuels.Length + 1)); //? scale fuels in ODFC_config.modes for (int n = 0; n <= ODFC_config.modes[m].fuels.Length - 1; n++) { ODFC_config.modes[m].fuels[n].rate *= scaleFactor.quadratic; } // Log.Info(String.Format("Byproducts in mode: {0} / {1}", (m + 1), ODFC_config.modes[m].byproducts.Length + 1)); //? scale byproducts in ODFC_config.modes for (int n = 0; n <= ODFC_config.modes[m].byproducts.Length - 1; n++) { ODFC_config.modes[m].byproducts[n].rate *= scaleFactor.quadratic; } } updateEditor(); // updateFuelTexts(); // removed.this }