From 87d2cf3fcffafca867a70f781e7e464dea06e688 Mon Sep 17 00:00:00 2001 From: MaxDorob Date: Wed, 4 Dec 2024 01:06:15 +0600 Subject: [PATCH] Moved comments --- .../Verbs/Verb_LaunchProjectileCE.cs | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs b/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs index ec837daba3..8add7d3355 100644 --- a/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs +++ b/Source/CombatExtended/CombatExtended/Verbs/Verb_LaunchProjectileCE.cs @@ -984,14 +984,23 @@ public override bool TryStartCastOn(LocalTargetInfo castTarg, LocalTargetInfo de protected virtual bool KeepBurstOnNoShootLine(bool suppressing, out ShootLine shootLine) { + // 1: Interruptible -> stop shooting + // 2: Not interruptible -> continue shooting at last position (do *not* shoot at target position as it will play badly with skip or other teleport effects) + // 3: Suppressing fire -> set our shoot line and continue + // 4: else -> stop + // Target missing + // Mid burst + // 5: Interruptible -> stop shooting + // 6: Not interruptible -> shoot along previous line + // 7: else -> stop shootLine = (ShootLine)lastShootLine; - if (LockRotationAndAngle) // Case 2,3,6,7 + if (LockRotationAndAngle) // Case 1,2,5,6 { - if (VerbPropsCE.interruptibleBurst && !suppressing) // Case 2, 6 + if (VerbPropsCE.interruptibleBurst && !suppressing) // Case 1, 5 { return false; } - // Case 3, 7 + // Case 2, 6 if (lastShootLine == null) { return false; @@ -1000,9 +1009,9 @@ protected virtual bool KeepBurstOnNoShootLine(bool suppressing, out ShootLine sh currentTarget = new LocalTargetInfo(lastTargetPos); lastExactPos = lastTargetPos.ToVector3Shifted(); } - else // case 4,5,8 + else // case 3,4,7 { - if (suppressing) // case 4,5 + if (suppressing) // case 3,4 { if (currentTarget.IsValid && !currentTarget.ThingDestroyed) { @@ -1040,21 +1049,13 @@ public override bool TryCastShot() // Cannot hit target // Target exists // Mid burst - // 2: Interruptible -> stop shooting - // 3: Not interruptible -> continue shooting at last position (do *not* shoot at target position as it will play badly with skip or other teleport effects) - // 4: Suppressing fire -> set our shoot line and continue - // 5: else -> stop - // Target missing - // Mid burst - // 6: Interruptible -> stop shooting - // 7: Not interruptible -> shoot along previous line - // 8: else -> stop + // 2: Check if we should continue shooting if (TryFindCEShootLineFromTo(caster.Position, currentTarget, out var shootLine, out var targetLoc)) // Case 1 { lastShootLine = shootLine; lastExactPos = targetLoc; } - else // We cannot hit the current target + else // Case 2. We cannot hit the current target, check if we should continue shooting { if (!KeepBurstOnNoShootLine(suppressing, out shootLine)) {