From ff15bc4a6e4ae2343c26eaa631f8278d620722ec Mon Sep 17 00:00:00 2001 From: MaxDorob Date: Thu, 4 Jul 2024 03:34:58 +0600 Subject: [PATCH] Fix for shamblers (and crawling pawns) - tactial comps not used for them anymore --- .../Comps/CompTacticalManager.cs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Comps/CompTacticalManager.cs b/Source/CombatExtended/CombatExtended/Comps/CompTacticalManager.cs index d5bb8e7152..d2f1a46cbc 100644 --- a/Source/CombatExtended/CombatExtended/Comps/CompTacticalManager.cs +++ b/Source/CombatExtended/CombatExtended/Comps/CompTacticalManager.cs @@ -106,6 +106,8 @@ public bool DraftedColonist } } + public bool Active => (!SelPawn.mutant?.HasTurned ?? true) && !SelPawn.Crawling; + private readonly TargetIndex[] _targetIndices = new TargetIndex[] { TargetIndex.A, @@ -116,7 +118,7 @@ public bool DraftedColonist public override void CompTick() { base.CompTick(); - if (parent.IsHashIntervalTick(120)) + if (parent.IsHashIntervalTick(120) && Active) { /* * Clear the cache if it's very outdated to allow GC to take over @@ -196,6 +198,10 @@ public override void CompTick() public override void CompTickRare() { base.CompTickRare(); + if (!Active) + { + return; + } TryGiveTacticalJobs(); if (_counter++ % 2 == 0) { @@ -259,15 +265,18 @@ bool AllChecksPassed(Verb verb, LocalTargetInfo castTarg, LocalTargetInfo destTa public void Notify_BulletImpactNearby() { - foreach (ICompTactics comp in TacticalComps) + if (Active) { - try - { - comp.Notify_BulletImpactNearBy(); - } - catch (Exception er) + foreach (ICompTactics comp in TacticalComps) { - Log.Error($"CE: Error running Notify_BulletImpactNearBy {comp.GetType()} with error {er}"); + try + { + comp.Notify_BulletImpactNearBy(); + } + catch (Exception er) + { + Log.Error($"CE: Error running Notify_BulletImpactNearBy {comp.GetType()} with error {er}"); + } } } }