diff --git a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs index 048fd979..12ce9195 100644 --- a/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs +++ b/Data/Scripts/CoreSystems/EntityComp/Parts/Weapon/WeaponTracking.cs @@ -1016,6 +1016,7 @@ public static Vector3D TrajectoryEstimation(Weapon weapon, Vector3D targetPos, V if (initialTti > interceptThreshold) { valid = false; + weapon.Target.ImpossibleToHit = true; // Mark target as impossible to hit return targetPos; } diff --git a/Data/Scripts/CoreSystems/Support/MiscTypes.cs b/Data/Scripts/CoreSystems/Support/MiscTypes.cs index df8f9b40..2efe8a24 100644 --- a/Data/Scripts/CoreSystems/Support/MiscTypes.cs +++ b/Data/Scripts/CoreSystems/Support/MiscTypes.cs @@ -18,6 +18,7 @@ public class Target internal TargetStates TargetState; internal bool HasTarget; internal bool IsAligned; + public bool ImpossibleToHit; internal bool SoftProjetileReset; internal bool TargetChanged; internal bool ClientDirty; diff --git a/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs b/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs index f40effe9..3a35c578 100644 --- a/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs +++ b/Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs @@ -250,30 +250,28 @@ private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgSt var delayNoTarget = !weapon.System.WConst.GiveUpAfter || s.Tick - weapon.LastShootTick > weapon.System.WConst.DelayAfterBurst; var notAnyBlock = comp.MasterOverrides.SubSystem != WeaponDefinition.TargetingDef.BlockTypes.Any; - var needsTarget = (!weapon.Target.HasTarget || Session.I.Tick - weapon.Target.ChangeTick <= 30) && comp.MasterOverrides.Grids && (comp.DetectOtherSignals && comp.MasterAi.DetectionInfo.OtherInRange || comp.MasterAi.DetectionInfo.PriorityInRange) && report && comp.Data.Repo.Values.Set.ReportTarget && delayNoTarget && comp.MasterAi.DetectionInfo.TargetInRange(weapon); + var needsTarget = (!weapon.Target.HasTarget || Session.I.Tick - weapon.Target.ChangeTick <= 30) && comp.MasterOverrides.Grids && (comp.DetectOtherSignals && comp.MasterAi.DetectionInfo.OtherInRange || comp.MasterAi.DetectionInfo.PriorityInRange) && report && comp.Data.Repo.Values.Set.ReportTarget && delayNoTarget && comp.MasterAi.DetectionInfo.TargetInRange(weapon); var showReloadIcon = (weapon.Loading || weapon.Reload.WaitForClient || s.Tick - weapon.LastLoadedTick < 60); - - string noTagetReason; + + string noTargetReason; var needNameUpdate = weapon.LastFriendlyNameTick == 0 || s.Tick - weapon.LastFriendlyNameTick > 600; if (needsTarget) { if (weapon.OutOfAmmo && !showReloadIcon) - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoAmmo) : weapon.FriendlyNameNoAmmo; + noTargetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoAmmo) : weapon.FriendlyNameNoAmmo; else if (comp.MasterOverrides.FocusSubSystem && !showReloadIcon && notAnyBlock && weapon.FoundTopMostTarget) - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoSubSystems) : weapon.FriendlyNameNoSubsystem; - - else if (weapon.) - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.ImpossibleToHit) : weapon.FriendlyNameImpossibleHit; - - else - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoTarget) : weapon.FriendlyNameNoTarget; + noTargetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoSubSystems) : weapon.FriendlyNameNoSubsystem; + else if (weapon.Target.ImpossibleToHit) + noTargetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.ImpossibleToHit) : weapon.FriendlyNameImpossibleHit; + else + noTargetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.NoTarget) : weapon.FriendlyNameNoTarget; } else { - noTagetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.Normal) : weapon.FriendlyName; + noTargetReason = needNameUpdate ? weapon.UpdateAndGetFriendlyName(Weapon.FriendlyNames.Normal) : weapon.FriendlyName; } var textOffset = bgStartPosX - _bgWidth + _reloadWidth + _padding; @@ -281,7 +279,7 @@ private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgSt var textInfo = _textDrawPool.Count > 0 ? _textDrawPool.Dequeue() : new TextDrawRequest(); - textInfo.Text = noTagetReason; + textInfo.Text = noTargetReason; var color = new Vector4(1, 1, 1, 1); textInfo.Color = color; textInfo.Position.X = textOffset; @@ -296,7 +294,7 @@ private void WeaponsToAdd(bool reset, Vector2D currWeaponDisplayPos, double bgSt textInfo.Text = $"(x{stackedInfo.WeaponStack})"; textInfo.Color = new Vector4(0.5f, 0.5f, 1, 1); - textInfo.Position.X = textOffset + (noTagetReason.Length * ((_textSize * s.AspectRatioInv) * 0.6f) * ShadowSizeScaler); + textInfo.Position.X = textOffset + (noTargetReason.Length * ((_textSize * s.AspectRatioInv) * 0.6f) * ShadowSizeScaler); textInfo.Position.Y = currWeaponDisplayPos.Y; textInfo.FontSize = _sTextSize;