Don't show window if between areas

This commit is contained in:
Liza 2023-10-14 16:26:06 +02:00
parent a0e7687b58
commit 375546b4ac
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 14 additions and 6 deletions

View File

@ -31,6 +31,9 @@ partial class WorkshopPlugin
}
private float GetDistanceToEventObject(IReadOnlyList<uint> npcIds, out GameObject? o)
{
Vector3? localPlayerPosition = _clientState.LocalPlayer?.Position;
if (localPlayerPosition != null)
{
foreach (var obj in _objectTable)
{
@ -39,7 +42,10 @@ partial class WorkshopPlugin
if (npcIds.Contains(GetNpcId(obj)))
{
o = obj;
return Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, obj.Position + new Vector3(0, -2, 0));
float distance = Vector3.Distance(localPlayerPosition.Value, obj.Position + new Vector3(0, -2, 0));
if (distance > 0.01)
return distance;
}
}
}
}

View File

@ -101,6 +101,8 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
if (!_clientState.IsLoggedIn ||
!WorkshopTerritories.Contains(_clientState.TerritoryType) ||
_condition[ConditionFlag.BoundByDuty] ||
_condition[ConditionFlag.BetweenAreas] ||
_condition[ConditionFlag.BetweenAreas51] ||
GetDistanceToEventObject(FabricationStationIds, out var fabricationStation) >= 3f)
{
_mainWindow.NearFabricationStation = false;

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.4</Version>
<Version>2.5</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>