Skip to content

Commit

Permalink
Improve PDA item sorting capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
vlyon committed Jun 16, 2023
1 parent ad188b0 commit a4a3eff
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Nautilus/Assets/Gadgets/GadgetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,48 @@ public static ScanningGadget SetPdaGroupCategoryBefore(this ICustomPrefab custom
return scanningGadget.WithPdaGroupCategoryBefore(group, category, target);
}

/// <summary>
/// Adds this item into a blueprint category to appear in.
/// </summary>
/// <param name="customPrefab">The custom prefab to add unlocks to.</param>
/// <param name="group">The main group in the PDA blueprints where this item appears.</param>
/// <param name="category">The category within the group in the PDA blueprints where this item appears.</param>
/// <param name="target">It will be added after this target item or at the end if not found.</param>
/// <returns>An instance to the created <see cref="ScanningGadget"/> to continue the scanning settings on.</returns>
/// <remarks>If the specified <paramref name="group"/> is a tech group that is present in the <see cref="uGUI_BuilderMenu.groups"/> list, this item will automatically
/// become buildable. To avoid this, or make this item a buildable manually, use the <see cref="ScanningGadget.SetBuildable"/> method.</remarks>
public static ScanningGadget SetPdaGroupCategoryAfter(this ICustomPrefab customPrefab, TechGroup group, TechCategory category, TechType target)
{
if (!customPrefab.TryGetGadget(out ScanningGadget scanningGadget))
{
scanningGadget = new ScanningGadget(customPrefab, TechType.None);
customPrefab.AddGadget(scanningGadget);
}

return scanningGadget.WithPdaGroupCategoryAfter(group, category, target);
}

/// <summary>
/// Adds this item into a blueprint category to appear in.
/// </summary>
/// <param name="customPrefab">The custom prefab to add unlocks to.</param>
/// <param name="group">The main group in the PDA blueprints where this item appears.</param>
/// <param name="category">The category within the group in the PDA blueprints where this item appears.</param>
/// <param name="target">It will be inserted before this target item or at the beginning if not found.</param>
/// <returns>An instance to the created <see cref="ScanningGadget"/> to continue the scanning settings on.</returns>
/// <remarks>If the specified <paramref name="group"/> is a tech group that is present in the <see cref="uGUI_BuilderMenu.groups"/> list, this item will automatically
/// become buildable. To avoid this, or make this item a buildable manually, use the <see cref="ScanningGadget.SetBuildable"/> method.</remarks>
public static ScanningGadget SetPdaGroupCategoryBefore(this ICustomPrefab customPrefab, TechGroup group, TechCategory category, TechType target)
{
if (!customPrefab.TryGetGadget(out ScanningGadget scanningGadget))
{
scanningGadget = new ScanningGadget(customPrefab, TechType.None);
customPrefab.AddGadget(scanningGadget);
}

return scanningGadget.WithPdaGroupCategoryBefore(group, category, target);
}

/// <summary>
/// Sets the type of equipment slot this item can fit into.
/// </summary>
Expand Down

0 comments on commit a4a3eff

Please sign in to comment.