From b8d44343c82d2cb839fd7f13b5228a6405c661c5 Mon Sep 17 00:00:00 2001 From: MaxDorob Date: Sat, 30 Nov 2024 18:39:29 +0600 Subject: [PATCH] Now it's possible to specify unavailable projectiles for Verb (can be useful for CIWS) --- .../CombatExtended/Things/Building_TurretGunCE.cs | 4 ++++ .../CombatExtended/CombatExtended/Verbs/VerbPropertiesCE.cs | 1 + .../CombatExtended/Verbs/Verb_LaunchProjectileCE.cs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/CombatExtended/CombatExtended/Things/Building_TurretGunCE.cs b/Source/CombatExtended/CombatExtended/Things/Building_TurretGunCE.cs index 5f343ed786..b6cf134f0d 100644 --- a/Source/CombatExtended/CombatExtended/Things/Building_TurretGunCE.cs +++ b/Source/CombatExtended/CombatExtended/Things/Building_TurretGunCE.cs @@ -419,6 +419,10 @@ public virtual void TryStartShootSomething(bool canBeginBurstImmediately) // public virtual LocalTargetInfo TryFindNewTarget() // Core method { + if (!AttackVerb.Available()) + { + return null; + } IAttackTargetSearcher attackTargetSearcher = this.TargSearcher(); Faction faction = attackTargetSearcher.Thing.Faction; float range = this.AttackVerb.verbProps.range; diff --git a/Source/CombatExtended/CombatExtended/Verbs/VerbPropertiesCE.cs b/Source/CombatExtended/CombatExtended/Verbs/VerbPropertiesCE.cs index 21312e035f..b374c7cb0c 100644 --- a/Source/CombatExtended/CombatExtended/Verbs/VerbPropertiesCE.cs +++ b/Source/CombatExtended/CombatExtended/Verbs/VerbPropertiesCE.cs @@ -18,5 +18,6 @@ public class VerbPropertiesCE : VerbProperties public bool ejectsCasings = true; public bool ignorePartialLoSBlocker = false; public bool interruptibleBurst = true; + public List cantShotWith = new List(); } } diff --git a/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs b/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs index c1102daf44..1094562581 100644 --- a/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs @@ -268,7 +268,7 @@ public override bool Available() } } - return Projectile != null; + return Projectile != null && !VerbPropsCE.cantShotWith.Contains(Projectile); } ///