private void SetupForIcon() { // This will deactivate objects on non-active subtypes before the part icon is created, avoiding a visual mess foreach (var subtype in subtypes) { subtype.Setup(this); subtype.DeactivateObjects(); } CurrentSubtype.ActivateObjects(); }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); // This will deactivate objects before the part icon is created, avoiding a visual mess for (int i = 0; i < subtypes.Count; i++) { PartSubtype subtype = subtypes[i]; subtype.SetParent(this); subtype.FindObjects(); subtype.DeactivateObjects(); } CurrentSubtype.ActivateObjects(); }
private void UpdateSubtype(bool fillTanks) { CurrentSubtype.ActivateObjects(); if (HighLogic.LoadedSceneIsEditor) { CurrentSubtype.ActivateNodes(); } UpdateTankSetup(fillTanks); if (CurrentSubtype.maxTemp > 0) { part.maxTemp = CurrentSubtype.maxTemp; } else { part.maxTemp = part.GetPrefab().maxTemp; } if (CurrentSubtype.skinMaxTemp > 0) { part.skinMaxTemp = CurrentSubtype.skinMaxTemp; } else { part.skinMaxTemp = part.GetPrefab().skinMaxTemp; } if (AttachNodeManaged && part.attachRules.allowSrfAttach && part.srfAttachNode != null) { var referenceNode = CurrentSubtype.attachNode ?? part.GetPrefab().srfAttachNode; part.srfAttachNode.position = referenceNode.position; part.srfAttachNode.orientation = referenceNode.orientation; part.srfAttachNode.size = referenceNode.size; } if (FARWrapper.FARLoaded && affectFARVoxels && managedTransformNames.Count > 0) { part.SendMessage("GeometryPartModuleRebuildMeshData"); } if (affectDragCubes && managedTransformNames.Count > 0) { DragCube newCube = DragCubeSystem.Instance.RenderProceduralDragCube(part); part.DragCubes.ClearCubes(); part.DragCubes.Cubes.Add(newCube); part.DragCubes.ResetCubeWeights(); } var window = FindObjectsOfType <UIPartActionWindow>().FirstOrDefault(w => w.part == part); if (window.IsNotNull()) { window.displayDirty = true; } if (HighLogic.LoadedSceneIsEditor) { GameEvents.onEditorPartEvent.Fire(ConstructionEventType.PartTweaked, part); GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); } else if (HighLogic.LoadedSceneIsFlight) { GameEvents.onVesselWasModified.Fire(this.vessel); } LogInfo("Switched subtype to " + CurrentSubtype.Name); }