State prev_state; // State during previous GPU frame update // pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) return; // check if has Connected Living Space mod hasCLS = Lib.HasAssembly("ConnectedLivingSpace"); // if part has Gravity Ring, find it. gravityRing = part.FindModuleImplementing<GravityRing>(); hasGravityRing = gravityRing != null; // calculate habitat internal volume if (volume <= double.Epsilon) volume = Lib.PartVolume(part); // calculate habitat external surface if (surface <= double.Epsilon) surface = Lib.PartSurface(part); // set RMB UI status strings Volume = Lib.HumanReadableVolume(volume); Surface = Lib.HumanReadableSurface(surface); // hide toggle if specified Events["Toggle"].active = toggle; Actions["Action"].active = toggle; // create animators if (!hasGravityRing) { inflate_anim = new Animator(part, inflate); } perctDeployed = Lib.Level(part, "Atmosphere", true); if (perctDeployed == 1) { RefreshDialog(); SetPassable(true); } // configure on start Configure(true); }
State prev_state; // State during previous GPU frame update // pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // check if has Connected Living Space mod hasCLS = Lib.HasAssembly("ConnectedLivingSpace"); // if part has Gravity Ring, find it. gravityRing = part.FindModuleImplementing <GravityRing>(); hasGravityRing = gravityRing != null; // calculate habitat internal volume if (volume <= double.Epsilon) { volume = Lib.PartVolume(part); } // calculate habitat external surface if (surface <= double.Epsilon) { surface = Lib.PartSurface(part); } // set RMB UI status strings Volume = Lib.HumanReadableVolume(volume); Surface = Lib.HumanReadableSurface(surface); // hide toggle if specified Events["Toggle"].active = toggle; Actions["Action"].active = toggle; // create animators if (!hasGravityRing) { inflate_anim = new Animator(part, inflate); } perctDeployed = Lib.Level(part, "Atmosphere", true); switch (this.state) { case State.enabled: Set_flow(true); break; case State.disabled: Set_flow(false); break; case State.pressurizing: Set_flow(true); break; case State.depressurizing: Set_flow(false); break; } if (Get_inflate_string().Length == 0) // not inflatable { SetPassable(true); UpdateIVA(true); } else { SetPassable(Math.Truncate(Math.Abs((perctDeployed + ResourceBalance.precision) - 1.0) * 100000) / 100000 <= ResourceBalance.precision); UpdateIVA(Math.Truncate(Math.Abs((perctDeployed + ResourceBalance.precision) - 1.0) * 100000) / 100000 <= ResourceBalance.precision); } if (Lib.IsFlight()) { // For fix IVA when crewTransfered occur, add event to define flag for FixedUpdate GameEvents.onCrewTransferred.Add(UpdateCrew); } // configure on start Configure(true); }
public static void Detect() { // set user-specified features Reliability = Settings.Reliability; Deploy = Settings.Deploy; Science = Settings.Science; SpaceWeather = Settings.SpaceWeather; Automation = Settings.Automation; // force-disable some features based on mods detected Reliability &= !Lib.HasAssembly("TestFlight"); // detect all modifiers in use by current profile HashSet <string> modifiers = new HashSet <string>(); foreach (Rule rule in Profile.rules) { foreach (string s in rule.modifiers) { modifiers.Add(s); } } foreach (Process process in Profile.processes) { foreach (string s in process.modifiers) { modifiers.Add(s); } } // detect features from modifiers Radiation = modifiers.Contains("radiation"); Shielding = modifiers.Contains("shielding"); LivingSpace = modifiers.Contains("living_space"); Comfort = modifiers.Contains("comfort"); Poisoning = modifiers.Contains("poisoning"); Pressure = modifiers.Contains("pressure"); Humidity = modifiers.Contains("humidity"); // habitat is enabled if any of the values it provides are in use Habitat = Shielding || LivingSpace || Poisoning || Pressure || Humidity || modifiers.Contains("volume") || modifiers.Contains("surface"); // supplies is enabled if any non-EC supply exist Supplies = Profile.supplies.Find(k => k.resource != "ElectricCharge") != null; // log features Lib.Log("features:"); Lib.Log("- Reliability: " + Reliability); Lib.Log("- Deploy: " + Deploy); Lib.Log("- Science: " + Science); Lib.Log("- SpaceWeather: " + SpaceWeather); Lib.Log("- Automation: " + Automation); Lib.Log("- Radiation: " + Radiation); Lib.Log("- Shielding: " + Shielding); Lib.Log("- LivingSpace: " + LivingSpace); Lib.Log("- Comfort: " + Comfort); Lib.Log("- Poisoning: " + Poisoning); Lib.Log("- Pressure: " + Pressure); Lib.Log("- Humidity: " + Humidity); Lib.Log("- Habitat: " + Habitat); Lib.Log("- Supplies: " + Supplies); }
public static void Detect() { // set user-specified features Reliability = Settings.Reliability; Signal = Settings.Signal; KCommNet = Settings.KCommNet && !Settings.Signal; Deploy = Settings.Deploy; Science = Settings.Science; SpaceWeather = Settings.SpaceWeather; Automation = Settings.Automation; // force-disable some features based on mods detected Reliability &= !Lib.HasAssembly("TestFlight"); Signal &= !Lib.HasAssembly("RemoteTech"); KCommNet &= !Signal; // detect all modifiers in use by current profile //HashSet<string> modifiers = new HashSet<string>(); //foreach(Rule rule in Profile.rules) //{ // foreach(string s in rule.modifiers) modifiers.Add(s); //} //foreach(Process process in Profile.processes) //{ // foreach(string s in process.modifiers) modifiers.Add(s); //} //// detect features from modifiers //Radiation = modifiers.Contains("radiation"); //Shielding = modifiers.Contains("shielding"); //LivingSpace = modifiers.Contains("living_space"); //Comfort = modifiers.Contains("comfort"); //Poisoning = modifiers.Contains("poisoning"); //Pressure = modifiers.Contains("pressure"); //// habitat is enabled if any of the values it provides are in use //Habitat = // Shielding // || LivingSpace // || Poisoning // || Pressure // || modifiers.Contains("volume") // || modifiers.Contains("surface"); //// supplies is enabled if any non-EC supply exist //Supplies = Profile.supplies.Find(k => k.resource != "ElectricCharge") != null; // log features Lib.Verbose("features:"); Lib.Verbose("- Reliability: " + Reliability); Lib.Verbose("- Signal: " + Signal); Lib.Verbose("- KCommNet: " + KCommNet); Lib.Verbose("- Deploy: " + Deploy); Lib.Verbose("- Science: " + Science); Lib.Verbose("- SpaceWeather: " + SpaceWeather); Lib.Verbose("- Automation: " + Automation); Lib.Verbose("- Radiation: " + Radiation); Lib.Verbose("- Shielding: " + Shielding); Lib.Verbose("- LivingSpace: " + LivingSpace); Lib.Verbose("- Comfort: " + Comfort); Lib.Verbose("- Poisoning: " + Poisoning); Lib.Verbose("- Pressure: " + Pressure); Lib.Verbose("- Habitat: " + Habitat); Lib.Verbose("- Supplies: " + Supplies); }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // check if has Connected Living Space mod hasCLS = Lib.HasAssembly("ConnectedLivingSpace"); // if part has Gravity Ring, find it. gravityRing = part.FindModuleImplementing <GravityRing>(); hasGravityRing = gravityRing != null; if (volume <= 0.0 || surface <= 0.0) { Habitat prefab = part.partInfo.partPrefab.FindModuleImplementing <Habitat>(); if (volume <= 0.0) { volume = prefab.volume; } if (surface <= 0.0) { surface = prefab.surface; } } // set RMB UI status strings Volume = Lib.HumanReadableVolume(volume); Surface = Lib.HumanReadableSurface(surface); // hide toggle if specified Events["Toggle"].active = toggle; //Actions["Action"].active = toggle; #if DEBUG Events["LogVolumeAndSurface"].active = true; #else Events["LogVolumeAndSurface"].active = Settings.VolumeAndSurfaceLogging; #endif // create animators if (!hasGravityRing) { inflate_anim = new Animator(part, inflate); } // add the cost of shielding to the base part cost shieldingCost = (float)surface * PartResourceLibrary.Instance.GetDefinition("Shielding").unitCost; // configure on start Configure(); perctDeployed = Lib.Level(part, "Atmosphere", true); switch (this.state) { case State.enabled: Set_flow(true); break; case State.disabled: Set_flow(false); break; case State.pressurizing: Set_flow(true); break; case State.depressurizing: Set_flow(false); break; } if (Get_inflate_string().Length == 0) // not inflatable { SetPassable(true); UpdateIVA(true); } else { SetPassable(Math.Truncate(Math.Abs((perctDeployed + ResourceBalance.precision) - 1.0) * 100000) / 100000 <= ResourceBalance.precision); UpdateIVA(Math.Truncate(Math.Abs((perctDeployed + ResourceBalance.precision) - 1.0) * 100000) / 100000 <= ResourceBalance.precision); } if (Lib.IsFlight()) { // For fix IVA when crewTransfered occur, add event to define flag for FixedUpdate GameEvents.onCrewTransferred.Add(UpdateCrew); } }