From c0d20f847d6cc339ec0b6e8201a27f6e47b4b7c0 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Thu, 24 Nov 2022 14:22:38 -0800 Subject: [PATCH] Update targets on an undo --- Source/ConformalDecals/ModuleConformalDecal.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/ConformalDecals/ModuleConformalDecal.cs b/Source/ConformalDecals/ModuleConformalDecal.cs index 1c91d33..8a42b7b 100644 --- a/Source/ConformalDecals/ModuleConformalDecal.cs +++ b/Source/ConformalDecals/ModuleConformalDecal.cs @@ -250,6 +250,7 @@ namespace ConformalDecals { if (HighLogic.LoadedSceneIsEditor) { GameEvents.onEditorPartEvent.Add(OnEditorEvent); GameEvents.onVariantApplied.Add(OnVariantApplied); + GameEvents.onEditorUndo.Add(OnEditorUndo); UpdateTweakables(); } @@ -287,6 +288,7 @@ namespace ConformalDecals { if (HighLogic.LoadedSceneIsEditor) { GameEvents.onEditorPartEvent.Remove(OnEditorEvent); GameEvents.onVariantApplied.Remove(OnVariantApplied); + GameEvents.onEditorUndo.Remove(OnEditorUndo); } if (HighLogic.LoadedSceneIsFlight) { @@ -350,6 +352,10 @@ namespace ConformalDecals { } } + protected void OnEditorUndo(ShipConstruct sc) { + UpdateTargets(); + } + protected void OnPartWillDie(Part willDie) { if (willDie == part.parent) { this.Log("Parent part about to be destroyed! Killing decal part.");