Skip to content

Commit

Permalink
notarget
Browse files Browse the repository at this point in the history
  • Loading branch information
InvalidArgument3 committed Jul 4, 2024
1 parent 433afec commit b1ce301
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions Data/Scripts/CoreSystems/Support/MiscTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 12 additions & 14 deletions Data/Scripts/CoreSystems/Ui/Hud/HudDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,38 +250,36 @@ 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;
var hasHeat = weapon.HeatPerc > 0;

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;
Expand All @@ -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;
Expand Down

0 comments on commit b1ce301

Please sign in to comment.