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

Fix AnalysisTech unlock message & sound #372

Merged
merged 6 commits into from
Jun 2, 2023
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
12 changes: 4 additions & 8 deletions Nautilus/Assets/Gadgets/ScanningGadget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace Nautilus.Assets.Gadgets;
/// </summary>
public class ScanningGadget : Gadget
{
private const string DefaultUnlockMessage = "NotficationBlueprintUnlocked";

private bool _isBuildable;

/// <summary>
Expand Down Expand Up @@ -177,7 +175,7 @@ public ScanningGadget WithAnalysisTech(
List<StoryGoal> storyGoalsToTrigger = null,
#endif
FMODAsset unlockSound = null,
string unlockMessage = "NotificationBlueprintUnlocked"
string unlockMessage = null
)
{
AnalysisTech ??= new KnownTech.AnalysisTech();
Expand All @@ -192,9 +190,7 @@ public ScanningGadget WithAnalysisTech(
AnalysisTech.storyGoals = storyGoalsToTrigger ?? new();
#endif
AnalysisTech.unlockSound = unlockSound;
AnalysisTech.unlockMessage = unlockMessage == DefaultUnlockMessage
? unlockMessage
: $"{prefab.Info.TechType.AsString()}_DiscoverMessage";
AnalysisTech.unlockMessage = unlockMessage ?? KnownTechHandler.DefaultUnlockData.BlueprintUnlockMessage;

return this;
}
Expand Down Expand Up @@ -246,11 +242,11 @@ protected internal override void Build()
PDAHandler.AddCustomScannerEntry(ScannerEntryData);
}

if (CompoundTechsForUnlock is { Count: > 0 } || RequiredForUnlock is not TechType.None)
if (CompoundTechsForUnlock is { Count: > 0 } || RequiredForUnlock != TechType.None)
{
if (AnalysisTech is null)
{
KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new[] { prefab.Info.TechType }, DefaultUnlockMessage);
KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new[] { prefab.Info.TechType }, KnownTechHandler.DefaultUnlockData.BlueprintUnlockMessage, KnownTechHandler.DefaultUnlockData.BlueprintUnlockSound);
}

KnownTechPatcher.UnlockedAtStart.Remove(prefab.Info.TechType);
Expand Down
6 changes: 3 additions & 3 deletions Nautilus/Handlers/KnownTechHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,16 @@ public static void RemoveAllCurrentAnalysisTechEntry(TechType targetTechType)
public static class DefaultUnlockData
{
/// <summary>Message on unlocking new creatures; "NEW LIFEFORM DISCOVERED"</summary>
public static string NewCreatureDiscoveredMessage { get; } = "NotificationCreatureDiscovered";
public const string NewCreatureDiscoveredMessage = "NotificationCreatureDiscovered";

/// <summary>Sound on unlocking new creatures; "NEW LIFEFORM DISCOVERED"</summary>
public static FMODAsset NewCreatureDiscoveredSound { get; } = AudioUtils.GetFmodAsset("event:/player/new_creature");

/// <summary>Message on unlocking new blueprints from picking up items; "NEW BLUEPRINT SYNTHESIZED FROM ALIEN RESOURCE"</summary>
public static string BlueprintPickupMessage { get; } = "NotificationBlueprintPickup";
public const string BlueprintPickupMessage = "NotificationBlueprintPickup";

/// <summary>Message on unlocking new blueprints from scanning; "NEW BLUEPRINT SYNTHESIZED"</summary>
public static string BlueprintUnlockMessage { get; } = "NotificationBlueprintUnlocked";
public const string BlueprintUnlockMessage = "NotificationBlueprintUnlocked";

/// <summary>Sound on unlocking new blueprints from scanning or picking up items; "NEW BLUEPRINT SYNTHESIZED"</summary>
public static FMODAsset BlueprintUnlockSound { get; } = AudioUtils.GetFmodAsset("event:/tools/scanner/new_blueprint");
Expand Down
2 changes: 1 addition & 1 deletion Nautilus/Patchers/KnownTechPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal static void InitializePostfix()

foreach (KnownTech.AnalysisTech tech in analysisTech)
{
if (UnlockSound == null && tech.unlockSound != null && tech.techType == TechType.Lead)
if (UnlockSound == null && tech.unlockSound != null && tech.techType == TechType.CreepvinePiece)
vlyon marked this conversation as resolved.
Show resolved Hide resolved
{
UnlockSound = tech.unlockSound;
}
Expand Down