mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix projecting onto parts using B9PS
This commit is contained in:
parent
d557df49fa
commit
261da9194b
Binary file not shown.
@ -237,14 +237,23 @@ namespace ConformalDecals {
|
|||||||
public override void OnStart(StartState state) {
|
public override void OnStart(StartState state) {
|
||||||
this.Log("Starting module");
|
this.Log("Starting module");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
materialProperties.RenderQueue = DecalQueue;
|
materialProperties.RenderQueue = DecalQueue;
|
||||||
|
|
||||||
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
UpdateMaterials();
|
UpdateMaterials();
|
||||||
|
|
||||||
|
// handle tweakables
|
||||||
|
if (HighLogic.LoadedSceneIsEditor) {
|
||||||
|
GameEvents.onEditorPartEvent.Add(OnEditorEvent);
|
||||||
|
GameEvents.onVariantApplied.Add(OnVariantApplied);
|
||||||
|
|
||||||
|
UpdateTweakables();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnStartFinished(StartState state) {
|
||||||
|
// handle game events
|
||||||
if (HighLogic.LoadedSceneIsGame) {
|
if (HighLogic.LoadedSceneIsGame) {
|
||||||
// set initial attachment state
|
// set initial attachment state
|
||||||
if (part.parent == null) {
|
if (part.parent == null) {
|
||||||
@ -254,27 +263,20 @@ namespace ConformalDecals {
|
|||||||
OnAttach();
|
OnAttach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle tweakables
|
|
||||||
if (HighLogic.LoadedSceneIsEditor) {
|
|
||||||
GameEvents.onEditorPartEvent.Add(OnEditorEvent);
|
|
||||||
GameEvents.onVariantApplied.Add(OnVariantApplied);
|
|
||||||
|
|
||||||
UpdateTweakables();
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle flight events
|
// handle flight events
|
||||||
if (HighLogic.LoadedSceneIsFlight) {
|
if (HighLogic.LoadedSceneIsFlight) {
|
||||||
GameEvents.onPartWillDie.Add(OnPartWillDie);
|
GameEvents.onPartWillDie.Add(OnPartWillDie);
|
||||||
|
|
||||||
|
if (part.parent == null) part.explode();
|
||||||
|
|
||||||
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
||||||
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
||||||
|
|
||||||
if (!selectableInFlight || !DecalConfig.SelectableInFlight) {
|
if (!selectableInFlight || !DecalConfig.SelectableInFlight) {
|
||||||
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
||||||
|
_boundsRenderer.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part.parent == null) part.explode();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user