Partially revert interaction IsTargetable changes and make GatheringPoint a special...
authorLiza Carvelli <liza@carvel.li>
Thu, 8 Aug 2024 12:48:33 +0000 (14:48 +0200)
committerLiza Carvelli <liza@carvel.li>
Thu, 8 Aug 2024 12:48:33 +0000 (14:48 +0200)
Questionable/Controller/Steps/Interactions/Interact.cs
Questionable/Functions/GameFunctions.cs

index 85e56c4449e1a26d00db6edbb92fff3ac4d4d725..cb2b3d6c4ea188cec166504a9989697d2aa52d7c 100644 (file)
@@ -66,7 +66,7 @@ internal static class Interact
 
         public bool Start()
         {
-            IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId, targetable: true);
+            IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId);
             if (gameObject == null)
             {
                 logger.LogWarning("No game object with dataId {DataId}", DataId);
@@ -113,7 +113,7 @@ internal static class Interact
 
             if (!_interacted)
             {
-                IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId, targetable: true);
+                IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId);
                 if (gameObject == null || !IsTargetable(gameObject) || !HasAnyMarker(gameObject))
                     return ETaskResult.StillRunning;
 
index 73f2a195424f74a5563ab0d5282e5847b5f3bc00..d52dd46973c7ce8a1d35b1a755522f3d44b5729f 100644 (file)
@@ -157,17 +157,19 @@ internal sealed unsafe class GameFunctions
                playerState->IsAetherCurrentUnlocked(aetherCurrentId);
     }
 
-    public IGameObject? FindObjectByDataId(uint dataId, ObjectKind? kind = null, bool targetable = false)
+    public IGameObject? FindObjectByDataId(uint dataId, ObjectKind? kind = null)
     {
         foreach (var gameObject in _objectTable)
         {
-            if (targetable && !gameObject.IsTargetable)
-                continue;
-
             if (gameObject.ObjectKind is ObjectKind.Player or ObjectKind.Companion or ObjectKind.MountType
                 or ObjectKind.Retainer or ObjectKind.Housing)
                 continue;
 
+            // multiple objects in the object table can share the same data id for gathering points; only one of those
+            // (at most) is visible
+            if (gameObject is { ObjectKind: ObjectKind.GatheringPoint, IsTargetable: false })
+                continue;
+
             if (gameObject.DataId == dataId && (kind == null || kind.Value == gameObject.ObjectKind))
             {
                 return gameObject;