Partially revert interaction IsTargetable changes and make GatheringPoint a special case

This commit is contained in:
Liza 2024-08-08 14:48:33 +02:00
parent a7af485369
commit c7961eb444
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 8 additions and 6 deletions

View File

@ -66,7 +66,7 @@ internal static class Interact
public bool Start() public bool Start()
{ {
IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId, targetable: true); IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId);
if (gameObject == null) if (gameObject == null)
{ {
logger.LogWarning("No game object with dataId {DataId}", DataId); logger.LogWarning("No game object with dataId {DataId}", DataId);
@ -113,7 +113,7 @@ internal static class Interact
if (!_interacted) if (!_interacted)
{ {
IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId, targetable: true); IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId);
if (gameObject == null || !IsTargetable(gameObject) || !HasAnyMarker(gameObject)) if (gameObject == null || !IsTargetable(gameObject) || !HasAnyMarker(gameObject))
return ETaskResult.StillRunning; return ETaskResult.StillRunning;

View File

@ -157,17 +157,19 @@ internal sealed unsafe class GameFunctions
playerState->IsAetherCurrentUnlocked(aetherCurrentId); 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) foreach (var gameObject in _objectTable)
{ {
if (targetable && !gameObject.IsTargetable)
continue;
if (gameObject.ObjectKind is ObjectKind.Player or ObjectKind.Companion or ObjectKind.MountType if (gameObject.ObjectKind is ObjectKind.Player or ObjectKind.Companion or ObjectKind.MountType
or ObjectKind.Retainer or ObjectKind.Housing) or ObjectKind.Retainer or ObjectKind.Housing)
continue; 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)) if (gameObject.DataId == dataId && (kind == null || kind.Value == gameObject.ObjectKind))
{ {
return gameObject; return gameObject;