// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // update RMB ui Fields["Status"].guiName = radiation >= 0.0 ? "Radiation" : "Active shielding"; Events["Toggle"].active = toggle; Actions["Action"].active = toggle; // deal with non-toggable emitters if (!toggle) { running = true; } // create animator active_anim = new Animator(part, active); // set animation initial state active_anim.Still(running ? 0.0 : 1.0); }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // 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 inflate_anim = new Animator(part, inflate); // configure on start Configure(true); }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) return; // get animations deploy_anim = new Animator(part, deploy); rotate_anim = new Animator(part, rotate); // if is using Transform rotate_transf = new Transformator(part, rotate, SpinRate, SpinAccelerationRate); // set animation state / invert animation deploy_anim.still(deployed ? 1.0f : 0.0f); deploy_anim.stop(); if (deployed) { rotate_transf.Play(); rotate_anim.play(false, true); } // show the deploy toggle if it is deployable Events["Toggle"].active = deploy.Length > 0; }
public ModuleAnimateGeneric customAnim; // Support to custom animation for ModuleDataTransmitter module public override void OnStart(StartState state) { base.OnStart(state); // don't break tutorial scenarios & do something only in Flight scenario if (Lib.DisableScenario(this) || !Lib.IsFlight()) { return; } if (Features.Signal) { Antenna a = part.FindModuleImplementing <Antenna>(); if (antennaPower == 0 && a != null) { antennaPower = a.dist; } } else { ModuleDataTransmitter transmitter = part.FindModuleImplementing <ModuleDataTransmitter>(); if (transmitter != null) { antennaPower = new AntennaEC(part.FindModuleImplementing <ModuleDataTransmitter>(), extra_Cost, extra_Deploy, antennaPower).Init(antennaPower); } } // verify if is using custom animation for CommNet customAnim = part.FindModuleImplementing <ModuleAnimateGeneric>(); }
public void Start() { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } if (slots > MAX_SLOTS) { slots = MAX_SLOTS; } Actions["Action"].guiName = Lib.BuildString(Local.Sickbay_Start_Stop, " ", title); //"Start/Stop" foreach (string s in patients.Split(',')) { if (s.Length > 0) { patientList.Add(s); } } // configure on start Configure(true, slots, cureEverybody); UpdateActions(); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // set UI text Actions["Action"].guiName = Localizer.Format("#KERBALISM_Laboratory_Action"); Events["CleanExperiments"].guiName = Localizer.Format("#KERBALISM_Laboratory_Clean"); // do nothing in the editors and when compiling parts if (!Lib.IsFlight()) { return; } // parse crew specs researcher_cs = new CrewSpecs(researcher); var hardDrive = part.FindModuleImplementing <HardDrive>(); if (hardDrive != null) { drive = hardDrive.GetDrive(); } else { drive = DB.Vessel(vessel).BestDrive(); } }
public KeyValuePair <bool, double> modReturn; // Return from ECDevice public override void OnStart(StartState state) { // don't break tutorial scenarios & do something only in Flight scenario if (Lib.DisableScenario(this) || !Lib.IsFlight()) { return; } Lib.Debug("Executing OnStart"); // cache list of modules module = part.FindModulesImplementing <PartModule>().FindLast(k => k.moduleName == type); // get energy from cache resources = ResourceCache.Info(vessel, "ElectricCharge"); hasEnergy = resources.amount > double.Epsilon; // Force the update to run at least once lastBrokenState = !broken; hasEnergyChanged = !hasEnergy; hasFixedEnergyChanged = !hasEnergy; #if DEBUG // setup UI Fields["actualCost"].guiActive = true; Fields["broken"].guiActive = true; #endif }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // update RMB ui Fields["Status"].guiName = title; Actions["Action"].active = toggle; if (toggle) { Events["Toggle"].guiActiveUnfocused = require_eva; Events["Toggle"].guiActive = !require_eva || Lib.IsEditor(); } // deal with non-toggable if (!toggle) { deployed = true; } // create animator deploy_anim = new Animator(part, animation); // set animation initial state deploy_anim.Still(deployed ? 1.0 : 0.0); deploy_cs = new CrewSpecs(crew_operate); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // do nothing in the editor if (state == StartState.Editor) { return; } // get panel if any panel = part.FindModuleImplementing <ModuleDeployableSolarPanel>(); if (panel != null) { // store rate rate = panel.resHandler.outputResources[0].rate; // reset rate // - This break mods that evaluate solar panel output for a reason or another (eg: AmpYear, BonVoyage). // We fix that by exploiting the fact that resHandler was introduced in KSP recently, and most of // these mods weren't updated to reflect the changes or are not aware of them, and are still reading // chargeRate. However the stock solar panel ignore chargeRate value during FixedUpdate. // So we only reset resHandler rate. panel.resHandler.outputResources[0].rate = 0.0f; // hide ui panel.Fields["status"].guiActive = false; panel.Fields["sunAOA"].guiActive = false; panel.Fields["flowRate"].guiActive = false; } }
public void Start() { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // get dump specs for associated process dump_specs = Profile.processes.Find(x => x.modifiers.Contains(resource)).dump; // set dump valve ui button Events["DumpValve"].active = dump_specs.AnyValves; // set active dump valve dump_specs.ValveIndex = valve_i; valve_i = dump_specs.ValveIndex; // set action group ui Actions["Action"].guiName = Lib.BuildString("Start/Stop ", title); // hide toggle if specified Events["Toggle"].active = toggle; Actions["Action"].active = toggle; // deal with non-togglable processes if (!toggle) { running = true; } // configure on start Configure(running, multiple); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // assume extended if there is no animator extended |= part.FindModuleImplementing <ModuleAnimationGroup>() == null; // create data stream, used if science system is disabled stream = new DataStream(); // in flight if (Lib.IsFlight()) { // get animator module, if any var anim = part.FindModuleImplementing <ModuleAnimationGroup>(); if (anim != null) { // resync extended state from animator // - rationale: extending in editor doesn't set extended to true, // leading to spurious signal loss for 1 tick on prelaunch extended = anim.isDeployed; // allow extending/retracting even when vessel is not controllable anim.Events["DeployModule"].guiActiveUncommand = true; anim.Events["RetractModule"].guiActiveUncommand = true; } } }
public override void OnStart(StartState state) { if (Lib.DisableScenario(this)) { return; } if (Lib.IsEditor()) { return; } foreach (var module in part.Modules) { if (module.moduleName == "SCANsat" || module.moduleName == "ModuleSCANresourceScanner") { scanner = module; break; } } if (scanner == null) { return; } sensorType = Lib.ReflectionValue <int>(scanner, "sensorType"); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } if (hdId == 0) { hdId = part.flightID; } if (drive == null) { if (!Lib.IsFlight()) { drive = new Drive(title, dataCapacity, sampleCapacity); } else { drive = DB.Drive(hdId, title, dataCapacity, sampleCapacity); } } if (vessel != null) { Cache.RemoveVesselObjectsCache(vessel, "drives"); } drive.is_private |= experiment_id.Length > 0; UpdateCapacity(); }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // get animations deploy_anim = new Animator(part, deploy); if (rotateIsTransform) { rotate_transf = new Transformator(part, rotate, SpinRate, SpinAccelerationRate); } else { rotate_anim = new Animator(part, rotate); } if (counterWeightRotateIsTransform) { counterWeightRotate_transf = new Transformator(part, counterWeightRotate, counterWeightSpinRate, counterWeightSpinAccelerationRate, false); } else { counterWeightRotate_anim = new Animator(part, counterWeightRotate); } // set animation state / invert animation deploy_anim.Still(deployed ? 1.0f : 0.0f); deploy_anim.Stop(); Update(); }
[KSPField] public string desc = string.Empty; // short description shown in part tooltip public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } }
[KSPField(isPersistant = true)] public bool considered; // true to consider the part modules in planner public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } if (Lib.IsEditor()) { Events["Toggle"].active = toggle; } }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) return; // assume deployed if there is no animator deployed |= part.FindModuleImplementing<ModuleAnimationGroup>() == null; // setup ui Fields["Abundance"].guiName = Lib.BuildString(resource, " abundance"); // get drill head transform only once if (drill.Length > 0) drill_head = part.FindModelTransform(drill); }
public override void OnStart(StartState state) { if (Lib.DisableScenario(this)) { return; } if (Lib.IsEditor()) { return; } resourcesProduced = ParseResources(resources_produced, false); resourcesConsumed = ParseResources(resources_produced, false); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // create animator pin_anim = new Animator(part, pin); // setup ui Fields["Status"].guiName = Lib.SpacesOnCaps(Lib.SpacesOnUnderscore(type)); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // create animator pin_anim = new Animator(part, pin); // setup ui Fields["Status"].guiName = Lib.UppercaseFirst(type); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // create animators if (shutters.Length > 0) { shutters_anim = new Animator(part, shutters); } if (plants.Length > 0) { plants_anim = new Animator(part, plants); } // still-play shutters animation if (shutters_anim != null) { shutters_anim.Still((active ^ animBackwards) ? 1.0 : 0.0); } // still-play plants animation if (plants_anim != null) { plants_anim.Still(growth); } // cache lamps renderer if (lamps.Length > 0) { foreach (var rdr in part.GetComponentsInChildren <Renderer>()) { if (rdr.name == lamps) { lamps_rdr = rdr; break; } } } // do not allow light tolerance to be zero if (light_tolerance <= double.Epsilon) { light_tolerance = 400.0; } }
string status = string.Empty; // string to show next to the ui button public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // do nothing in the editors and when compiling parts if (!Lib.IsFlight()) { return; } // parse crew specs researcher_cs = new CrewSpecs(researcher); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // assume extended if there is no animator extended |= part.FindModuleImplementing <ModuleAnimationGroup>() == null; if (cost == 0) { cost = dist / 50000000; } if (rate == 0) { rate = cost * 0.064; } // create data stream, used if science system is disabled stream = new DataStream(); // in flight if (Lib.IsFlight()) { #if DEBUG ecCost = cost.ToString() + "/s"; Rate = Lib.HumanReadableDataRate(rate); power = Lib.HumanReadableRange(dist); #endif // get animator module, if any var anim = part.FindModuleImplementing <ModuleAnimationGroup>(); if (anim != null) { // resync extended state from animator // - rationale: extending in editor doesn't set extended to true, // leading to spurious signal loss for 1 tick on prelaunch extended = anim.isDeployed; // allow extending/retracting anim.Events["DeployModule"].guiActiveUncommand = Settings.UnlinkedControl == UnlinkedCtrl.full; // "true" has been changed anim.Events["RetractModule"].guiActiveUncommand = Settings.UnlinkedControl == UnlinkedCtrl.full; // "true" has been changed } } }
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); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // create animator deploy_anim = new Animator(part, deploy); // set initial animation state deploy_anim.still(recording ? 1.0 : 0.0); // parse crew specs operator_cs = new CrewSpecs(crew); // get experiment title exp_name = ResearchAndDevelopment.GetExperiment(experiment).experimentTitle; }
CrewSpecs repair_cs; // crew specs public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // do nothing in the editors and when compiling parts if (!Lib.IsFlight()) { return; } // cache list of modules modules = part.FindModulesImplementing <PartModule>().FindAll(k => k.moduleName == type); // parse crew specs repair_cs = new CrewSpecs(repair); // setup ui Fields["Status"].guiName = title; Events["Inspect"].guiName = Lib.BuildString("Inspect <b>", title, "</b>"); Events["Repair"].guiName = Lib.BuildString("Repair <b>", title, "</b>"); // sync monobehaviour state with module state // - required as the monobehaviour state is not serialized if (broken) { foreach (PartModule m in modules) { m.enabled = false; } } // type-specific hacks if (broken) { Apply(true); } }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // set UI text Actions["Action"].guiName = Localizer.Format("#KERBALISM_Laboratory_Action"); Events["CleanExperiments"].guiName = Localizer.Format("#KERBALISM_Laboratory_Clean"); // do nothing in the editors and when compiling parts if (!Lib.IsFlight()) { return; } // parse crew specs researcher_cs = new CrewSpecs(researcher); }
// pseudo-ctor public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } // get animations deploy_anim = new Animator(part, deploy); rotate_anim = new Animator(part, rotate); // set animation state deploy_anim.still(deployed ? 1.0f : 0.0f); if (deployed) { rotate_anim.play(false, true); } // show the deploy toggle if it is deployable Events["Toggle"].active = deploy.Length > 0; }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } if (drive == null) { if (Lib.IsEditor()) { drive = new Drive(title, dataCapacity, sampleCapacity); } else { drive = DB.Vessel(vessel).DriveForPart(title, part, dataCapacity, sampleCapacity); } } UpdateCapacity(); }
public override void OnStart(StartState state) { // don't break tutorial scenarios if (Lib.DisableScenario(this)) { return; } if (remainingSampleMass < 0) { remainingSampleMass = sample_mass; if (sample_reservoir > float.Epsilon) { remainingSampleMass = sample_reservoir; } } // create animator deployAnimator = new Animator(part, anim_deploy); // set initial animation state deployAnimator.Still(recording ? 1.0 : 0.0); // parse crew specs if (!string.IsNullOrEmpty(crew_operate)) { operator_cs = new CrewSpecs(crew_operate); } if (!string.IsNullOrEmpty(crew_reset)) { reset_cs = new CrewSpecs(crew_reset); } if (!string.IsNullOrEmpty(crew_prepare)) { prepare_cs = new CrewSpecs(crew_prepare); } exp = ResearchAndDevelopment.GetExperiment(experiment_id); }