Skip to content

Commit

Permalink
Merge pull request #3238 from CombatExtended-Continued/ShamblerEquips…
Browse files Browse the repository at this point in the history
…WeaponFix

Tactital Comp deactivation for turned mutants and crawling mutants
  • Loading branch information
N7Huntsman authored Jul 3, 2024
2 parents efd0423 + ff15bc4 commit 8bd9bfc
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions Source/CombatExtended/CombatExtended/Comps/CompTacticalManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public bool DraftedColonist
}
}

public bool Active => (!SelPawn.mutant?.HasTurned ?? true) && !SelPawn.Crawling;

private readonly TargetIndex[] _targetIndices = new TargetIndex[]
{
TargetIndex.A,
Expand All @@ -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
Expand Down Expand Up @@ -196,6 +198,10 @@ public override void CompTick()
public override void CompTickRare()
{
base.CompTickRare();
if (!Active)
{
return;
}
TryGiveTacticalJobs();
if (_counter++ % 2 == 0)
{
Expand Down Expand Up @@ -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}");
}
}
}
}
Expand Down

0 comments on commit 8bd9bfc

Please sign in to comment.