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

feat: option for saving in Contracts Mode #533

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion components/contracts/contractRouting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { GetForPlay2Body } from "../types/gameSchemas"
import assert from "assert"
import { getUserData } from "../databaseHandler"
import { getCpd } from "../evergreen"
import { getFlag } from "../flags"

const contractRoutingRouter = Router()

Expand Down Expand Up @@ -96,6 +97,10 @@ contractRoutingRouter.post(
}

// Add escalation data to Contract data HERE
if (escalationTypes.includes(contractData.Metadata.Type)) {
contractData.Data.EnableSaving = false
}

contractData.Metadata = {
...contractData.Metadata,
...(escalationTypes.includes(contractData.Metadata.Type)
Expand All @@ -110,7 +115,10 @@ contractRoutingRouter.post(
}

// Edit usercreated contract data HERE
if (contractTypes.includes(contractData.Metadata.Type)) {
if (
contractTypes.includes(contractData.Metadata.Type) &&
!getFlag("enableContractsModeSaving")
) {
contractData.Data.EnableSaving = false
}

Expand Down
6 changes: 6 additions & 0 deletions components/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export const defaultFlags: Flags = {
desc: "Show elusive targets in instinct like normal targets would appear on normal missions. (for speedrunners who are submitting to speedrun.com, just as a reminder, this tool is for practice only!)",
default: false,
},
enableContractsModeSaving: {
category: "Gameplay",
title: "enableContractsModeSaving",
desc: "Enable saving in Contracts Mode, including both usercreated and featured contracts. Please note that even if you enable this, the saving function is consistent with the setting in the contract.",
default: false,
},
legacyNoticedKillScoring: {
category: "Gameplay",
title: "legacyNoticedKillScoring",
Expand Down