Skip to content

Fix targest nearest attacking ship in multiplayer#7326

Open
wookieejedi wants to merge 3 commits intoscp-fs2open:masterfrom
wookieejedi:multi-target-nearest-attacker-fix
Open

Fix targest nearest attacking ship in multiplayer#7326
wookieejedi wants to merge 3 commits intoscp-fs2open:masterfrom
wookieejedi:multi-target-nearest-attacker-fix

Conversation

@wookieejedi
Copy link
Copy Markdown
Member

Pressing 'Target Nearest Attackerin multiplayer does not work when a ship has spontaneously targeted another ship. This is because within,multi_oo_pack_data goals[0].target_nameonly covers explicitly ordered goal targets and is empty for spontaneous IFF-based engagements, which meanstarget_signature` does not return the proper value. This PR adds an extra check for that to pefer the live target_objnum so clients know who is actually being attacked.

Tested and works as expected.

Pressing 'Target Nearest Attacker` in multiplayer does not work when a ship has spontaneously targeted another ship. This is because within, `multi_oo_pack_data` `goals[0].target_name` only covers explicitly ordered goal targets and is empty for spontaneous IFF-based engagements, which means `target_signature` does not return the proper value. This PR adds an extra check for that to pefer the live target_objnum so clients know who is actually being attacked.

Tested and works as expected.
@wookieejedi wookieejedi added this to the Release 25.0.1 milestone Mar 29, 2026
@wookieejedi wookieejedi added fix A fix for bugs, not-a-bugs, and/or regressions. multi A feature or issue related to the multiplayer code. labels Mar 29, 2026
Copy link
Copy Markdown
Contributor

@notimaginative notimaginative left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments really need to be sorted out. There are 3 lines of comments which shouldn't have been changed at all, and having 4 lines worth of comments before an else should really be no-no.

@wookieejedi
Copy link
Copy Markdown
Member Author

Good points, just pushed an update, thanks!

Copy link
Copy Markdown
Contributor

@notimaginative notimaginative left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. multi A feature or issue related to the multiplayer code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants