From 8b212e41a3f472110f95476a152d433dd2a679af Mon Sep 17 00:00:00 2001 From: BAKEZQ Date: Sun, 29 Mar 2020 19:04:32 +0800 Subject: [PATCH] Auto-activate ActivableEffect weapon when defend https://github.com/jecrell/Star-Wars---Fully-Functional-Lightsabers/issues/11#issue-333027613 --- .../CompActivatableEffect/HarmonyCompActivatableEffect.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/AllModdingComponents/CompActivatableEffect/HarmonyCompActivatableEffect.cs b/Source/AllModdingComponents/CompActivatableEffect/HarmonyCompActivatableEffect.cs index 296db10f..d3275e4b 100644 --- a/Source/AllModdingComponents/CompActivatableEffect/HarmonyCompActivatableEffect.cs +++ b/Source/AllModdingComponents/CompActivatableEffect/HarmonyCompActivatableEffect.cs @@ -106,8 +106,10 @@ public static bool TryStartCastOnPrefix(ref bool __result, Verb __instance) { } - if (compActivatableEffect.CurrentState == CompActivatableEffect.State.Activated) return true; - + if (compActivatableEffect.CurrentState == CompActivatableEffect.State.Activated) + return true; + else if (compActivatableEffect.TryActivate()) + return true; if (Find.TickManager.TicksGame % 250 == 0) Messages.Message("DeactivatedWarning".Translate(pawn.Label), MessageTypeDefOf.RejectInput); @@ -300,4 +302,4 @@ public static void GetGizmosPrefix(Pawn __instance, ref IEnumerable __res } } } -} \ No newline at end of file +}