From ac08818a5938baad3bab99db022fceff4df41a2f Mon Sep 17 00:00:00 2001 From: drewcassidy Date: Mon, 29 Jun 2020 18:41:46 -0700 Subject: [PATCH] Fix projecting onto parts using B9PS --- .../Plugins/ConformalDecals.dll | 2 +- .../ConformalDecals/ModuleConformalDecal.cs | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index d0f41f3..e87c61c 100644 --- a/GameData/ConformalDecals/Plugins/ConformalDecals.dll +++ b/GameData/ConformalDecals/Plugins/ConformalDecals.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b4405eaa6d2efc358a8364e1cc9ea3eba73c42f6a3d50da1433447ca989068a +oid sha256:beb39430b4be794e704675541a85ed94395dc8dca57f9e680adfdaaac501e916 size 41984 diff --git a/Source/ConformalDecals/ModuleConformalDecal.cs b/Source/ConformalDecals/ModuleConformalDecal.cs index c5b06e2..578d23b 100644 --- a/Source/ConformalDecals/ModuleConformalDecal.cs +++ b/Source/ConformalDecals/ModuleConformalDecal.cs @@ -237,14 +237,23 @@ namespace ConformalDecals { public override void OnStart(StartState state) { this.Log("Starting module"); - - materialProperties.RenderQueue = DecalQueue; _boundsRenderer = decalProjectorTransform.GetComponent(); 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) { // set initial attachment state if (part.parent == null) { @@ -254,27 +263,20 @@ namespace ConformalDecals { OnAttach(); } } - - // handle tweakables - if (HighLogic.LoadedSceneIsEditor) { - GameEvents.onEditorPartEvent.Add(OnEditorEvent); - GameEvents.onVariantApplied.Add(OnVariantApplied); - - UpdateTweakables(); - } // handle flight events if (HighLogic.LoadedSceneIsFlight) { GameEvents.onPartWillDie.Add(OnPartWillDie); + if (part.parent == null) part.explode(); + Part.layerMask |= 1 << DecalConfig.DecalLayer; decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer; if (!selectableInFlight || !DecalConfig.SelectableInFlight) { decalColliderTransform.GetComponent().enabled = false; + _boundsRenderer.enabled = false; } - - if (part.parent == null) part.explode(); } }