public override void OnStart(PartModule.StartState state) { BasePAWGroup CommunicationGroup = new BasePAWGroup("CF_Comms", "#CAE_PAW_Group_Name", true); Fields[nameof(statusText)].group = CommunicationGroup; Events[nameof(ToggleAntenna)].group = CommunicationGroup; SetScalar(AntennaEnabled ? 1f : 0f); }
public override void OnStart(StartState state) { deployAnimator = new Animator(part, animationName, animReverse); deployAnimator.Still(moduleData.isRunning ? 1f : 0f); Fields["UIState"].guiName = title; if (uiGroupName != null) { var group = new BasePAWGroup(uiGroupName, uiGroupDisplayName ?? uiGroupName, false); Events["ToggleEvent"].group = group; Fields["UIState"].group = group; } }
/// <summary> /// Returns the default PAW-Group /// </summary> /// <param name="uiGroup">if not null this instance is returned, if instance displayName is null or empty the default PAW group will be set on this instance</param> /// <returns></returns> protected BasePAWGroup GetPawGroup(BasePAWGroup uiGroup = null) { if (!string.IsNullOrEmpty(uiGroup?.displayName)) { return(uiGroup); } if (uiGroup == null) { uiGroup = new BasePAWGroup(WOLF_UI_GROUP_NAME, WOLF_UI_GROUP_DISPLAY_NAME, false); } else { uiGroup.name = WOLF_UI_GROUP_NAME; uiGroup.displayName = WOLF_UI_GROUP_DISPLAY_NAME; } return(uiGroup); }
public void Start() { //Log("ModuleGeneratorAntenna Start"); BasePAWGroup CommunicationGroup = new BasePAWGroup("CF_Comms", "#CAE_PAW_Group_Name", true); Fields[nameof(ECConsumptionStr)].group = CommunicationGroup; List <ModuleDataTransmitter> MDTs = part.Modules.OfType <ModuleDataTransmitter>().ToList(); if (MDTs.Count == 1) { moduleDT = MDTs[0]; } if (HighLogic.LoadedScene == GameScenes.FLIGHT && /*moduleDeployable*/ moduleDT == null) { Activate(); } double rate = this.resHandler.inputResources[0].rate; ECConsumptionStr = Formatter.StringRate(rate); Fields["efficiency"].guiActive = false; Fields["efficiency"].guiActiveEditor = false; Fields["displayStatus"].guiActive = false; Fields["displayStatus"].guiActiveEditor = false; Events["Activate"].guiActive = false; Events["Shutdown"].guiActive = false; Actions["ToggleAction"].active = false; Actions["ActivateAction"].active = false; Actions["ShutdownAction"].active = false; //CommNet.CommNetParams commNetParams = HighLogic.CurrentGame.Parameters.CustomParams<CommNet.CommNetParams>(); //commNetParams.rangeModifier //foreach (var f in this.Events) // Log(f.name + " | " + f.guiName + " | " + f.GUIName); }
public override void OnStart(StartState state) { base.OnStart(state); hasSensor = false; HasAttractor = false; EnergyConsumptionK = Utils.ClampL(EnergyConsumptionK, 1e-6f); thermalLossesK = 1 + ThermalLossesRatio; damperActive = DamperEnabled; deactivateTimer.Period = AutoDeactivateAfterSeconds; if (!string.IsNullOrEmpty(Sensors)) { foreach (var sensorName in Utils.ParseLine(Sensors, Utils.Whitespace)) { var sensor = part.FindModelComponent <MeshFilter>(sensorName); if (sensor == null) { this.Log($"Unable to find {sensorName} MeshFilter in {part.name}"); continue; } addSensor(sensor); hasSensor = true; } if (hasSensor) { socket = part.CreateSocket(); if (!string.IsNullOrEmpty(AffectedPartTags)) { tags = Utils.ParseLine(AffectedPartTags, Utils.Comma); } if (!string.IsNullOrEmpty(AttractorLocation)) { attractor = part.FindModelTransform(AttractorLocation); if (attractor != null) { HasAttractor = true; switch (AttractorMainAxis) { case AttractorAxis.right: attractorAxis = Vector3.right; break; case AttractorAxis.up: attractorAxis = Vector3.up; break; case AttractorAxis.fwd: attractorAxis = Vector3.forward; break; default: attractorAxis = Vector3.forward; break; } } } animator = part.GetAnimator(AnimatorID); if (DamperEnabled) { animator?.Open(); } else { animator?.Close(); } StartCoroutine(dampPackedVessels()); } } if (!hasSensor) { this.EnableModule(false); return; } // setup visibility of actions, events and various PAW fields var damper_controllable = hasSensor && EnableControls; var attractor_controllable = damper_controllable && HasAttractor; Fields[nameof(DamperEnabled)].OnValueModified += onDamperToggle; Utils.EnableField(Fields[nameof(DamperEnabled)], damper_controllable); Utils.EnableField(Fields[nameof(Attenuation)], damper_controllable); Utils.EnableField(Fields[nameof(AutoEnable)], damper_controllable); Actions[nameof(ToggleAction)].active = damper_controllable; Utils.EnableField(Fields[nameof(AttractorEnabled)], attractor_controllable); Utils.EnableField(Fields[nameof(InvertAttractor)], attractor_controllable); Actions[nameof(ToggleAttractorAction)].active = attractor_controllable; setupAttractorPowerControl(attractor_controllable); // setup PAW group if (GroupPAWFields) { var group = new BasePAWGroup( $"{GetType().Name}_{GetInstanceID()}", string.IsNullOrEmpty(DamperID) ? "Magnetic Damper" : Utils.ParseCamelCase(DamperID), false); group.startCollapsed = !EnableControls; foreach (var field in Fields) { field.group = group; } } }