Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate selected Titan loadout index better #762

Merged
merged 6 commits into from
Apr 11, 2024

Conversation

ASpoonPlaysGames
Copy link
Contributor

@ASpoonPlaysGames ASpoonPlaysGames commented Nov 18, 2023

Seemingly there are cases where mods can set an invalid Titan loadout index, which then causes the progression checks to attempt to set the player's Titan model to an invalid index.

This PR just adds a check to ensure that it is within the bounds of the titan loadout array.

@ASpoonPlaysGames ASpoonPlaysGames added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Nov 18, 2023
@GeckoEidechse
Copy link
Member

I assume there isn't an easy way to test this?

@ASpoonPlaysGames
Copy link
Contributor Author

ASpoonPlaysGames commented Nov 21, 2023

I assume there isn't an easy way to test this?

  1. sv_cheats 1 as script requires cheats.
  2. script GetPlayerArray()[0].SetPersistentVar("titanSpawnLoadout.index", 9) in lobby with progression disabled
  3. Enable progression, it shouldnt crash anymore

Copy link
Member

@GeckoEidechse GeckoEidechse left a comment

Choose a reason for hiding this comment

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

Confirmed working in testing.

Performed the steps as described here: #762 (comment)

  • Without PR -> script crash
  • With PR -> reset the invalid TitanLoadout

@GeckoEidechse GeckoEidechse added almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge and removed needs testing Changes from the PR still need to be tested labels Nov 22, 2023
@GeckoEidechse GeckoEidechse changed the title Validate selected titan loadout index better Validate selected Titan loadout index better Jan 23, 2024
Copy link
Contributor

@Zanieon Zanieon left a comment

Choose a reason for hiding this comment

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

Tested and by setting pdata index beyond 6 and it falls back to Ion.

Copy link
Contributor

@Alystrasz Alystrasz left a comment

Choose a reason for hiding this comment

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

Confirmed working in testing.
With this PR, selectedTitanLoadoutIndex is set to 0 if it's deemed invalid, effectively resetting player titan to Ion.

@Zanieon Zanieon added READY TO MERGE This mergeable right now and removed needs code review Changes from PR still need to be reviewed in code almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge labels Mar 26, 2024
@GeckoEidechse
Copy link
Member

Merging based on reviews

@GeckoEidechse GeckoEidechse merged commit 11787b3 into R2Northstar:main Apr 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
READY TO MERGE This mergeable right now
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants