mirror of
https://github.com/PorktoberRevolution/ReStocked
synced 2024-09-01 17:34:42 +00:00
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 MiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 MiB |
@ -233,6 +233,11 @@
|
||||
@raycastTransformName = Panel_006
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockDeployableMeshHider
|
||||
transformName = TinyRadDeform
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockHeatEffects
|
||||
enableHeatEmissive = true
|
||||
@ -280,6 +285,11 @@
|
||||
@raycastTransformName = B_MedRad_Raycast
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockDeployableMeshHider
|
||||
transformName = RadMed_DeformablePipes
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockHeatEffects
|
||||
enableHeatEmissive = true
|
||||
@ -327,6 +337,13 @@
|
||||
@raycastTransformName = B_LargeRad_Raycast
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockDeployableMeshHider
|
||||
transformName = RadLrg_Deform01
|
||||
transformName = RadLrg_Deform02
|
||||
transformName = RadLrg_Deform03
|
||||
}
|
||||
MODULE
|
||||
{
|
||||
name = ModuleRestockHeatEffects
|
||||
enableHeatEmissive = true
|
||||
|
Binary file not shown.
@ -50,7 +50,7 @@ v1.1.0
|
||||
- Fixed the Pollux SRB using FX from RestockPlus - flames would not show if RS+ was not installed
|
||||
- Fixed the centering of the Rovemate probe core
|
||||
- Fixed some smoothing groups on the white variant of the Rockomax X-32 Fuel Tank
|
||||
|
||||
- Fixed an issue where radiators would freak out when destroyed.
|
||||
|
||||
v1.0.3
|
||||
-----
|
||||
|
@ -99,7 +99,7 @@ PART
|
||||
manufacturer = #LOC_RestockPlus_agency_paperclips
|
||||
description = #LOC_RestockPlus_restock-engine-caravel_description
|
||||
attachRules = 1,1,1,0,0
|
||||
mass = 1.6
|
||||
mass = 2.0
|
||||
dragModelType = default
|
||||
maximum_drag = 0.2
|
||||
minimum_drag = 0.3
|
||||
@ -137,8 +137,8 @@ PART
|
||||
}
|
||||
atmosphereCurve
|
||||
{
|
||||
key = 0 340
|
||||
key = 1 285
|
||||
key = 0 320
|
||||
key = 1 265
|
||||
key = 9 0.001
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ v1.1.0
|
||||
- Adjusted configs for Caravel, Schnauzer to account for a bug Squad fixed in 1.9
|
||||
- Fixed SkinnedMeshRenderer scaling for Caravel, Schnauzer (#800)
|
||||
- Fixed an issue with the thrust transforms on the Cherenkov nuclear engine (#804)
|
||||
|
||||
- Reduced Caravel vacuum Isp to 265/320s from 285/340s, increased mass to 2.0t from 1.6t
|
||||
v1.0.3
|
||||
-----
|
||||
- Updated ModuleManager distribution to 4.1.3
|
||||
|
104
Source/Restock/ModuleRestockDeployableMeshHider.cs
Normal file
104
Source/Restock/ModuleRestockDeployableMeshHider.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Restock
|
||||
{
|
||||
public class ModuleRestockDeployableMeshHider: PartModule
|
||||
{
|
||||
private ModuleDeployablePart deployable;
|
||||
public List<GameObject> disableableGameObjects;
|
||||
private ModuleDeployablePart.DeployState savedState;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private string serializedNode;
|
||||
|
||||
public override void OnLoad(ConfigNode node)
|
||||
{
|
||||
base.OnLoad(node);
|
||||
|
||||
if (serializedNode == null)
|
||||
serializedNode = node.ToString();
|
||||
}
|
||||
|
||||
|
||||
public override void OnStart(StartState state)
|
||||
{
|
||||
base.OnStart(state);
|
||||
if (HighLogic.LoadedSceneIsFlight)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(serializedNode))
|
||||
{
|
||||
this.LogError("Serialized node is null or empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigNode node = ConfigNode.Parse(serializedNode).nodes[0];
|
||||
LoadTransforms(node);
|
||||
|
||||
|
||||
deployable = this.GetComponent<ModuleDeployablePart>();
|
||||
if (deployable == null)
|
||||
{
|
||||
Debug.LogError("No ModuleDeployablePart found on part");
|
||||
return;
|
||||
}
|
||||
|
||||
savedState = deployable.deployState;
|
||||
SetVisibility(savedState != ModuleDeployablePart.DeployState.BROKEN);
|
||||
}
|
||||
}
|
||||
public void LoadTransforms(ConfigNode node)
|
||||
{
|
||||
|
||||
disableableGameObjects = new List<GameObject>();
|
||||
|
||||
foreach (string transformName in node.GetValues("transformName"))
|
||||
{
|
||||
|
||||
Transform[] transforms = part.FindModelTransforms(transformName);
|
||||
if (transforms.Length == 0)
|
||||
{
|
||||
this.LogError($"No transforms named '{transformName}' found in model");
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (Transform xform in transforms)
|
||||
{
|
||||
disableableGameObjects.Add(xform.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetVisibility(bool visible)
|
||||
{
|
||||
for (int i = 0; i < disableableGameObjects.Count; i++)
|
||||
{
|
||||
disableableGameObjects[i].SetActive(visible);
|
||||
}
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
if (HighLogic.LoadedSceneIsFlight && deployable && disableableGameObjects.Count > 0)
|
||||
{
|
||||
|
||||
if (deployable.deployState != savedState)
|
||||
{
|
||||
SetVisibility(deployable.deployState != ModuleDeployablePart.DeployState.BROKEN);
|
||||
savedState = deployable.deployState;
|
||||
}
|
||||
}
|
||||
}
|
||||
void OnDestroy()
|
||||
{
|
||||
|
||||
if (HighLogic.LoadedSceneIsFlight && disableableGameObjects.Count > 0)
|
||||
SetVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user