Let the player target and mark neutrals, and fix the HUD lock direction

TargetReticle, TargetNext and TargetPrevious now consider all visible
entities except self (hostile and neutral), not just VisibleEnemies, so a
neutral wanderer can be selected. TargetNearest stays enemies-only (it drives
weapon lock) but now picks the nearest target: it was using MaxBy, which
picked the farthest.

Adds a "Toggle Stance" input action (bound to the N key; report names which)
that flips the player's own stance on the current target between hostile and
neutral via Entity.SetIff -- one button for the whole affordance, per the
operator's request. Also keeps the "iff hostile"/"iff neutral"/"iff clear"
console commands next to the existing ones, since they cost nothing extra
alongside the hotkey.

Fixes the HUD lock indicator's hostility check, which read
Target.IsHostileTo(CurrentEntity) instead of CurrentEntity.IsHostileTo(Target)
-- the same backwards direction as LockWeapon, fixed in the prior commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-17 14:01:15 +02:00
commit a5fd8f1d1d
3 changed files with 107 additions and 8 deletions

View file

@ -182,6 +182,16 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
""initialStateCheck"": false,
""priority"": 0
},
{
""name"": ""Toggle Stance"",
""type"": ""Button"",
""id"": ""708d5aa5-3d0e-4ffe-920e-a4c95179d99c"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false,
""priority"": 0
},
{
""name"": ""Override Shutdown"",
""type"": ""Button"",
@ -421,6 +431,17 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""1f8c8f5e-4078-4066-b780-67d9c2261e46"",
""path"": ""<Keyboard>/n"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Toggle Stance"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""8e8b5d19-20fd-43f3-88cf-6246f374e7cf"",
@ -1159,6 +1180,7 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
m_Player_TargetNearest = m_Player.FindAction("Target Nearest", throwIfNotFound: true);
m_Player_ToggleHeatsinks = m_Player.FindAction("Toggle Heatsinks", throwIfNotFound: true);
m_Player_ToggleShield = m_Player.FindAction("Toggle Shield", throwIfNotFound: true);
m_Player_ToggleStance = m_Player.FindAction("Toggle Stance", throwIfNotFound: true);
m_Player_OverrideShutdown = m_Player.FindAction("Override Shutdown", throwIfNotFound: true);
m_Player_Ping = m_Player.FindAction("Ping", throwIfNotFound: true);
m_Player_HideUI = m_Player.FindAction("Hide UI", throwIfNotFound: true);
@ -1274,6 +1296,7 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_TargetNearest;
private readonly InputAction m_Player_ToggleHeatsinks;
private readonly InputAction m_Player_ToggleShield;
private readonly InputAction m_Player_ToggleStance;
private readonly InputAction m_Player_OverrideShutdown;
private readonly InputAction m_Player_Ping;
private readonly InputAction m_Player_HideUI;
@ -1327,6 +1350,10 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
/// </summary>
public InputAction @ToggleShield => m_Wrapper.m_Player_ToggleShield;
/// <summary>
/// Provides access to the underlying input action "Player/ToggleStance".
/// </summary>
public InputAction @ToggleStance => m_Wrapper.m_Player_ToggleStance;
/// <summary>
/// Provides access to the underlying input action "Player/OverrideShutdown".
/// </summary>
public InputAction @OverrideShutdown => m_Wrapper.m_Player_OverrideShutdown;
@ -1399,6 +1426,9 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
@ToggleShield.started += instance.OnToggleShield;
@ToggleShield.performed += instance.OnToggleShield;
@ToggleShield.canceled += instance.OnToggleShield;
@ToggleStance.started += instance.OnToggleStance;
@ToggleStance.performed += instance.OnToggleStance;
@ToggleStance.canceled += instance.OnToggleStance;
@OverrideShutdown.started += instance.OnOverrideShutdown;
@OverrideShutdown.performed += instance.OnOverrideShutdown;
@OverrideShutdown.canceled += instance.OnOverrideShutdown;
@ -1452,6 +1482,9 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
@ToggleShield.started -= instance.OnToggleShield;
@ToggleShield.performed -= instance.OnToggleShield;
@ToggleShield.canceled -= instance.OnToggleShield;
@ToggleStance.started -= instance.OnToggleStance;
@ToggleStance.performed -= instance.OnToggleStance;
@ToggleStance.canceled -= instance.OnToggleStance;
@OverrideShutdown.started -= instance.OnOverrideShutdown;
@OverrideShutdown.performed -= instance.OnOverrideShutdown;
@OverrideShutdown.canceled -= instance.OnOverrideShutdown;
@ -1945,6 +1978,13 @@ public partial class @AetheriaInput: IInputActionCollection2, IDisposable
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnToggleShield(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Toggle Stance" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnToggleStance(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Override Shutdown" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />