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

Handle basecamp component selection cancellation #36740

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Prevent exploit allowing cheaper basecamp actions"

Purpose of change

Various basecamp actions require components and tools to be consumed.

When there are choices to be made amongst these, the player is presented with the choice between the various options in the usual way.

However, if the player cancels, the action proceeded regardless. This allowed the player to circumvent the consumption of the requirements.

Describe the solution

Fix this by separating the selection of the components from the consumption. Now the order of events is:

  • Select components and tools.
  • Select NPC.
  • Send NPC on mission.
  • Consume components and tools.

We needed to perform the split because we need to select both the requirements and the NPC before performing alterations to either.

Implemented by introducing a new class basecamp_action_components to store this selection state.

Describe alternatives you've considered

Thought about using the existing functions with a failure return value, but that would have required pulling the NPC off the mission after they had already been assigned, which is tricky at best.

Testing

Verified in-game that cancelled selections mean that the whole process is aborted, whereas previously the NPC was assigned and the components were partially consumed.

Additional context

Found this while working on #36657. This is a blocker for that.

@jbytheway jbytheway force-pushed the basecamp_consumption branch 2 times, most recently from e4c9524 to 061cae0 Compare January 6, 2020 12:32
@curstwist curstwist added [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Player Faction Base / Camp All about the player faction base/camp/site labels Jan 6, 2020
Various basecamp actions require components and tools to be consumed.

When there are choices to be made amongst these, the player is presented
with the choice between the various options in the usual way.

However, if the player cancels, the action proceeded regardless.  This
allowed the player to circumvent the consumption of the requirements.

Fix this by separating the selection of the components from the
consumption.  Now the order of events is:

- Select components and tools.
- Select NPC.
- Send NPC on mission.
- Consume components and tools.

We needed to perform the split because we need to select both the
requirements and the NPC before performing alterations to either.

Implemented by introducing a new class basecamp_action_components to
store this selection state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants