message: Clean up loadout parameters
diff: @@ -614,11 +614,17 @@ function setClearSpace(clearSpace: boolean): LoadoutUpdateFunction {
  });
  }
  +export function setLoadoutParameters(params: Partial<LoadoutParameters>): LoadoutUpdateFunction {
  + return (loadout) => ({
  + ...loadout,
  + parameters: { ...loadout.parameters, ...params },
  + });
  +}
  +
  /**
  * Replace the mods in this loadout with all the mods currently on this character's equipped armor.
  */
  export function syncModsFromEquipped(store: DimStore): LoadoutUpdateFunction {
  - return (loadout) => {
  const mods: number[] = [];
  const equippedArmor = store.items.filter(
  (item) => item.equipped && itemCanBeInLoadout(item) && item.bucket.sort === 'Armor'
  @@ -627,14 +633,9 @@ export function syncModsFromEquipped(store: DimStore): LoadoutUpdateFunction {
  mods.push(...extractArmorModHashes(item));
  }
  - return {
  - ...loadout,
  - parameters: {
  - ...loadout.parameters,
  + return setLoadoutParameters({
  mods,
  - },
  - };
  - };
  + });
  }
  export function clearBucketCategory(
  @@ -672,42 +673,22 @@ export function clearMods(): LoadoutUpdateFunction {
  });
  }
  -/* TODO:
  -const LoadoutParametersUpdateFunction = ()
  -
  -function updateLoadoutParameters() {
  -
  -}
  -*/
  -
  export function changeClearMods(enabled: boolean): LoadoutUpdateFunction {
  - return (loadout) => ({
  - ...loadout,
  - parameters: {
  - ...loadout.parameters,
  + return setLoadoutParameters({
  clearMods: enabled,
  - },
  });
  }
  export function updateMods(mods: number[]): LoadoutUpdateFunction {
  - return (loadout) => ({
  - ...loadout,
  - parameters: {
  - ...loadout.parameters,
  + return setLoadoutParameters({
  mods,
  - },
  });
  }
  export function updateModsByBucket(
  modsByBucket: { [bucketHash: number]: number[] } | undefined
  ): LoadoutUpdateFunction {
  - return (loadout) => ({
  - ...loadout,
  - parameters: {
  - ...loadout.parameters,
  + return setLoadoutParameters({
  modsByBucket: _.isEmpty(modsByBucket) ? undefined : modsByBucket,
  - },
  });
  }
  