From fe296952a4210d0429255058e9b38d26b97d6d7e Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 31 Aug 2022 11:28:52 -0400 Subject: [PATCH 01/12] Start new achievements --- NewHorizons/Assets/translations/english.json | 12 ++++++++++ .../AchievementsPlus/AchievementHandler.cs | 3 +++ .../AchievementsPlus/NH/RaftingAchievement.cs | 23 +++++++++++++++++++ .../NH/SuckedIntoLavaByTornadoAchievement.cs | 23 +++++++++++++++++++ .../NH/TalkToFiveCharactersAchievement.cs | 23 +++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs create mode 100644 NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs create mode 100644 NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index b7aae651..753d2dc5 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -40,6 +40,18 @@ "NH_VESSEL_WARP": { "Name": "Lore Accurate", "Description": "Warp to a star system using the Vessel." + }, + "NH_RAFTING": { + "Name": "The Raft and the Furious", + "Description": "Go rafting." + }, + "NH_SUCKED_INTO_LAVA_BY_TORNADO": { + "Name": "Placeholder", + "Description": "Get sucked into lava by a tornado." + }, + "NH_TALK_TO_FIVE_CHARACTERS": { + "Name": "Placeholder", + "Description": "Talk to 5 characters." } } } diff --git a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs index 32942654..bf6ada93 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs @@ -39,6 +39,9 @@ namespace NewHorizons.OtherMods.AchievementsPlus NH.EatenOutsideBrambleAchievement.Init(); NH.NewFrequencyAchievement.Init(); NH.ProbeLostAchievement.Init(); + NH.RaftingAchievement.Init(); + NH.TalkToFiveCharactersAchievement.Init(); + NH.SuckedIntoLavaByTornadoAchievement.Init(); API.RegisterTranslationsFromFiles(Main.Instance, "Assets/translations"); diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs new file mode 100644 index 00000000..0ed6249a --- /dev/null +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.OtherMods.AchievementsPlus.NH +{ + public static class RaftingAchievement + { + public static readonly string UNIQUE_ID = "NH_RAFTING"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + } + + public static void Earn() + { + AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs new file mode 100644 index 00000000..3d0d1efd --- /dev/null +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.OtherMods.AchievementsPlus.NH +{ + public static class SuckedIntoLavaByTornadoAchievement + { + public static readonly string UNIQUE_ID = "NH_SUCKED_INTO_LAVA_BY_TORNADO"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + } + + public static void Earn() + { + AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs new file mode 100644 index 00000000..4a59cc24 --- /dev/null +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.OtherMods.AchievementsPlus.NH +{ + public static class TalkToFiveCharactersAchievement + { + public static readonly string UNIQUE_ID = "NH_TALK_TO_FIVE_CHARACTERS"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + } + + public static void Earn() + { + AchievementHandler.Earn(UNIQUE_ID); + } + } +} From db8910f2154871f0db2f86343cef3c9df8280988 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 31 Aug 2022 11:29:12 -0400 Subject: [PATCH 02/12] Raft --- NewHorizons/Builder/Props/RaftBuilder.cs | 13 ++++++++++++- .../AchievementsPlus/NH/RaftingAchievement.cs | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/RaftBuilder.cs b/NewHorizons/Builder/Props/RaftBuilder.cs index 6ad6277f..51e01a3e 100644 --- a/NewHorizons/Builder/Props/RaftBuilder.cs +++ b/NewHorizons/Builder/Props/RaftBuilder.cs @@ -1,4 +1,5 @@ -using NewHorizons.Components; +using NewHorizons.Components; +using NewHorizons.Components.Achievement; using NewHorizons.External.Modules; using NewHorizons.Handlers; using NewHorizons.Utility; @@ -54,6 +55,16 @@ namespace NewHorizons.Builder.Props sector.OnSectorOccupantsUpdated += lightSensor.OnSectorOccupantsUpdated; } + var achievementObject = new GameObject("AchievementVolume"); + achievementObject.transform.SetParent(raftObject.transform, false); + + var shape = achievementObject.AddComponent(); + shape.radius = 3; + shape.SetCollisionMode(Shape.CollisionMode.Volume); + + achievementObject.AddComponent()._shape = shape; + achievementObject.AddComponent(); + raftObject.SetActive(true); } } diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs index 0ed6249a..8fd2a23e 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/RaftingAchievement.cs @@ -1,3 +1,4 @@ +using NewHorizons.Components.Achievement; using System; using System.Collections.Generic; using System.Linq; @@ -6,10 +7,15 @@ using System.Threading.Tasks; namespace NewHorizons.OtherMods.AchievementsPlus.NH { - public static class RaftingAchievement + public class RaftingAchievement : AchievementVolume { public static readonly string UNIQUE_ID = "NH_RAFTING"; + private void Awake() + { + achievementID = UNIQUE_ID; + } + public static void Init() { AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); From 968ef6a1e310aeb37f7559750f23d1e744ef5a0e Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 15:04:04 -0500 Subject: [PATCH 03/12] Sucked into lava by tornado --- NewHorizons/Patches/AchievementPatches.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 NewHorizons/Patches/AchievementPatches.cs diff --git a/NewHorizons/Patches/AchievementPatches.cs b/NewHorizons/Patches/AchievementPatches.cs new file mode 100644 index 00000000..f0a459ad --- /dev/null +++ b/NewHorizons/Patches/AchievementPatches.cs @@ -0,0 +1,20 @@ +using HarmonyLib; +using NewHorizons.OtherMods.AchievementsPlus.NH; +using System.Linq; + +namespace NewHorizons.Patches +{ + [HarmonyPatch] + public static class AchievementPatches + { + [HarmonyPrefix] + [HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))] + public static void DeathManager_KillPlayer(DeathType deathType) + { + if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume)) + { + SuckedIntoLavaByTornadoAchievement.Earn(); + } + } + } +} From 16131fa6f451dece613bf7daa3c216964a80cad0 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 15:10:16 -0500 Subject: [PATCH 04/12] Earn probe lost achievement with destruction volumes too + only set entered eye condition when at the eye --- NewHorizons/Patches/AchievementPatches.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/NewHorizons/Patches/AchievementPatches.cs b/NewHorizons/Patches/AchievementPatches.cs index f0a459ad..21d7a8d1 100644 --- a/NewHorizons/Patches/AchievementPatches.cs +++ b/NewHorizons/Patches/AchievementPatches.cs @@ -1,6 +1,7 @@ using HarmonyLib; using NewHorizons.OtherMods.AchievementsPlus.NH; using System.Linq; +using UnityEngine; namespace NewHorizons.Patches { @@ -16,5 +17,26 @@ namespace NewHorizons.Patches SuckedIntoLavaByTornadoAchievement.Earn(); } } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ProbeDestructionDetector), nameof(ProbeDestructionDetector.FixedUpdate))] + public static bool ProbeDestructionDetector_FixedUpdate(ProbeDestructionDetector __instance) + { + if (__instance._activeVolumes.Count > 0 && __instance._safetyVolumes.Count == 0) + { + if (LoadManager.GetCurrentScene() == OWScene.EyeOfTheUniverse) + { + DialogueConditionManager.SharedInstance.SetConditionState("PROBE_ENTERED_EYE", conditionState: true); + Debug.Log("PROBE DESTROYED (ENTERED THE EYE)"); + } + else + Debug.Log("PROBE DESTROYED"); + + ProbeLostAchievement.Earn(); + Object.Destroy(__instance._probe.gameObject); + } + __instance.enabled = false; + return false; + } } } From 813cca1b33e2c113b6601b1d884778a3fe679da2 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 15:25:38 -0500 Subject: [PATCH 05/12] Talk to five characters --- NewHorizons/External/NewHorizonsData.cs | 19 +++++++++++++++++++ .../NH/TalkToFiveCharactersAchievement.cs | 8 ++++++++ NewHorizons/Patches/AchievementPatches.cs | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 2a2c8c5d..58904d4e 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -83,12 +83,14 @@ namespace NewHorizons.External KnownSignals = new List(); NewlyRevealedFactIDs = new List(); PopupsRead = new List(); + CharactersTalkedTo = new List(); } public List KnownFrequencies { get; } public List KnownSignals { get; } public List NewlyRevealedFactIDs { get; } public List PopupsRead { get; } + public List CharactersTalkedTo { get; } } #region Frequencies @@ -172,5 +174,22 @@ namespace NewHorizons.External } #endregion + + #region Characters talked to + + public static void OnTalkedToCharacter(string name) + { + if (name == CharacterDialogueTree.RECORDING_NAME || name == CharacterDialogueTree.SIGN_NAME) return; + _activeProfile?.PopupsRead.SafeAdd(name); + Save(); + } + + public static bool HasTalkedToFiveCharacters() + { + if (_activeProfile == null) return false; + return _activeProfile.CharactersTalkedTo.Count >= 5; + } + + #endregion } } \ No newline at end of file diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs index 4a59cc24..dcc9809c 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs @@ -1,3 +1,4 @@ +using NewHorizons.External; using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +14,13 @@ namespace NewHorizons.OtherMods.AchievementsPlus.NH public static void Init() { AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + if (NewHorizonsData.HasTalkedToFiveCharacters()) Earn(); + } + + public static void OnTalkedToCharacter(string name) + { + NewHorizonsData.OnTalkedToCharacter(name); + if (NewHorizonsData.HasTalkedToFiveCharacters()) Earn(); } public static void Earn() diff --git a/NewHorizons/Patches/AchievementPatches.cs b/NewHorizons/Patches/AchievementPatches.cs index 21d7a8d1..3b7ea097 100644 --- a/NewHorizons/Patches/AchievementPatches.cs +++ b/NewHorizons/Patches/AchievementPatches.cs @@ -38,5 +38,9 @@ namespace NewHorizons.Patches __instance.enabled = false; return false; } + + [HarmonyPostfix] + [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))] + public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance) => TalkToFiveCharactersAchievement.OnTalkedToCharacter(__instance._characterName); } } From 22ab1b438165dd7a2f137966067eabc3f4139815 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 15:45:08 -0500 Subject: [PATCH 06/12] Add progress --- NewHorizons/External/NewHorizonsData.cs | 6 ++++++ .../AchievementsPlus/AchievementHandler.cs | 21 +++++++++++++++++++ .../AchievementsPlus/IAchievements.cs | 2 ++ .../NH/TalkToFiveCharactersAchievement.cs | 14 ++++++++++++- 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 58904d4e..3e49bb24 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -190,6 +190,12 @@ namespace NewHorizons.External return _activeProfile.CharactersTalkedTo.Count >= 5; } + public static int GetCharactersTalkedTo() + { + if (_activeProfile == null) return 0; + return _activeProfile.CharactersTalkedTo.Count; + } + #endregion } } \ No newline at end of file diff --git a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs index bf6ada93..89355b4b 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs @@ -90,6 +90,27 @@ namespace NewHorizons.OtherMods.AchievementsPlus API.RegisterAchievement(unique_id, secret, mod); } + public static bool HasAchievement(string unique_id) + { + if (!Enabled) return false; + + return API.HasAchievement(unique_id); + } + + public static void UpdateProgess(string unique_id, int current, int final, bool showPopup) + { + if (!Enabled) return; + + API.UpdateProgress(unique_id, current, final, showPopup); + } + + public static int GetProgress(string unique_id) + { + if (!Enabled) return 0; + + return API.GetProgress(unique_id); + } + public static void OnLearnSignal() { if (!Enabled) return; diff --git a/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs b/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs index 9572ca1e..349002e2 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs @@ -9,5 +9,7 @@ namespace NewHorizons.OtherMods.AchievementsPlus void RegisterTranslationsFromFiles(ModBehaviour mod, string folderPath); void EarnAchievement(string uniqueID); bool HasAchievement(string uniqueID); + void UpdateProgress(string uniqueID, int current, int final, bool showPopup); + int GetProgress(string uniqueID); } } diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs index dcc9809c..b2947bd7 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/TalkToFiveCharactersAchievement.cs @@ -14,18 +14,30 @@ namespace NewHorizons.OtherMods.AchievementsPlus.NH public static void Init() { AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + UpdateProgress(false); if (NewHorizonsData.HasTalkedToFiveCharacters()) Earn(); } public static void OnTalkedToCharacter(string name) { NewHorizonsData.OnTalkedToCharacter(name); - if (NewHorizonsData.HasTalkedToFiveCharacters()) Earn(); + if (NewHorizonsData.HasTalkedToFiveCharacters()) + { + UpdateProgress(false); + Earn(); + } + else + UpdateProgress(true); } public static void Earn() { AchievementHandler.Earn(UNIQUE_ID); } + + public static void UpdateProgress(bool showPopup) + { + AchievementHandler.UpdateProgess(UNIQUE_ID, NewHorizonsData.GetCharactersTalkedTo(), 5, showPopup); + } } } From 6847471536be1848793a62eecfcea25bb3aedf4d Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 15:45:16 -0500 Subject: [PATCH 07/12] simplify --- .../NH/SuckedIntoLavaByTornadoAchievement.cs | 8 ++++++-- NewHorizons/Patches/AchievementPatches.cs | 10 ---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs index 3d0d1efd..944e8362 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs @@ -13,11 +13,15 @@ namespace NewHorizons.OtherMods.AchievementsPlus.NH public static void Init() { AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + GlobalMessenger.AddListener("PlayerDeath", OnPlayerDeath); } - public static void Earn() + public static void OnPlayerDeath(DeathType deathType) { - AchievementHandler.Earn(UNIQUE_ID); + if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume)) + { + AchievementHandler.Earn(UNIQUE_ID); + } } } } diff --git a/NewHorizons/Patches/AchievementPatches.cs b/NewHorizons/Patches/AchievementPatches.cs index 3b7ea097..92feb118 100644 --- a/NewHorizons/Patches/AchievementPatches.cs +++ b/NewHorizons/Patches/AchievementPatches.cs @@ -8,16 +8,6 @@ namespace NewHorizons.Patches [HarmonyPatch] public static class AchievementPatches { - [HarmonyPrefix] - [HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))] - public static void DeathManager_KillPlayer(DeathType deathType) - { - if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume)) - { - SuckedIntoLavaByTornadoAchievement.Earn(); - } - } - [HarmonyPrefix] [HarmonyPatch(typeof(ProbeDestructionDetector), nameof(ProbeDestructionDetector.FixedUpdate))] public static bool ProbeDestructionDetector_FixedUpdate(ProbeDestructionDetector __instance) From cc31f5f245edb1eb4deceeafd0df0019fa488654 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 16:07:08 -0500 Subject: [PATCH 08/12] =?UTF-8?q?Society=20=F0=9F=98=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NewHorizons/Assets/translations/english.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index 89a2196b..4674e64f 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -58,7 +58,7 @@ "Description": "Get sucked into lava by a tornado." }, "NH_TALK_TO_FIVE_CHARACTERS": { - "Name": "Placeholder", + "Name": "Society", "Description": "Talk to 5 characters." } } From b0faebf85fa21c106ff52ea338a821e92369b703 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 16:21:16 -0500 Subject: [PATCH 09/12] oops --- NewHorizons/External/NewHorizonsData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 3e49bb24..ea787b2b 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -180,7 +180,7 @@ namespace NewHorizons.External public static void OnTalkedToCharacter(string name) { if (name == CharacterDialogueTree.RECORDING_NAME || name == CharacterDialogueTree.SIGN_NAME) return; - _activeProfile?.PopupsRead.SafeAdd(name); + _activeProfile?.CharactersTalkedTo.SafeAdd(name); Save(); } From f7bad482355a82d3b8c7186b3730270376ac033c Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 17:00:39 -0500 Subject: [PATCH 10/12] Lava is different from Energy --- .../AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs index 944e8362..066eed0b 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/SuckedIntoLavaByTornadoAchievement.cs @@ -18,7 +18,7 @@ namespace NewHorizons.OtherMods.AchievementsPlus.NH public static void OnPlayerDeath(DeathType deathType) { - if (deathType == DeathType.Energy && Locator.GetPlayerDetector().GetComponent()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume)) + if (deathType == DeathType.Lava && Locator.GetPlayerDetector().GetComponent()._activeVolumes.Any(fluidVolume => fluidVolume is TornadoFluidVolume or TornadoBaseFluidVolume or HurricaneFluidVolume)) { AchievementHandler.Earn(UNIQUE_ID); } From 0ab737913b700ac986c917934d9579eb19dfe300 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 17:52:14 -0500 Subject: [PATCH 11/12] Dieclone --- NewHorizons/Assets/translations/english.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index 4674e64f..9d1a4c28 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -54,7 +54,7 @@ "Description": "Go rafting." }, "NH_SUCKED_INTO_LAVA_BY_TORNADO": { - "Name": "Placeholder", + "Name": "Dieclone", "Description": "Get sucked into lava by a tornado." }, "NH_TALK_TO_FIVE_CHARACTERS": { From 56e0aafb7278f28c2de414fb9b694833fb98b4d7 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 26 Nov 2022 18:45:36 -0500 Subject: [PATCH 12/12] Check for NH characters --- NewHorizons/Builder/Props/DialogueBuilder.cs | 3 ++- NewHorizons/Components/NHCharacterDialogueTree.cs | 6 ++++++ NewHorizons/Patches/AchievementPatches.cs | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 NewHorizons/Components/NHCharacterDialogueTree.cs diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 738f9da8..d4b5c844 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -6,6 +6,7 @@ using System.Xml; using UnityEngine; using NewHorizons.Utility; using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Components; namespace NewHorizons.Builder.Props { @@ -114,7 +115,7 @@ namespace NewHorizons.Builder.Props interact.enabled = false; } - var dialogueTree = conversationZone.AddComponent(); + var dialogueTree = conversationZone.AddComponent(); var xml = File.ReadAllText(Path.Combine(mod.Manifest.ModFolderPath, info.xmlFile)); var text = new TextAsset(xml) diff --git a/NewHorizons/Components/NHCharacterDialogueTree.cs b/NewHorizons/Components/NHCharacterDialogueTree.cs new file mode 100644 index 00000000..c68c85f4 --- /dev/null +++ b/NewHorizons/Components/NHCharacterDialogueTree.cs @@ -0,0 +1,6 @@ +namespace NewHorizons.Components +{ + public class NHCharacterDialogueTree : CharacterDialogueTree + { + } +} diff --git a/NewHorizons/Patches/AchievementPatches.cs b/NewHorizons/Patches/AchievementPatches.cs index 92feb118..5c1a21ed 100644 --- a/NewHorizons/Patches/AchievementPatches.cs +++ b/NewHorizons/Patches/AchievementPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components; using NewHorizons.OtherMods.AchievementsPlus.NH; using System.Linq; using UnityEngine; @@ -31,6 +32,12 @@ namespace NewHorizons.Patches [HarmonyPostfix] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))] - public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance) => TalkToFiveCharactersAchievement.OnTalkedToCharacter(__instance._characterName); + public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance) + { + if (__instance is NHCharacterDialogueTree) + { + TalkToFiveCharactersAchievement.OnTalkedToCharacter(__instance._characterName); + } + } } }