Don't show window if between areas
This commit is contained in:
parent
a0e7687b58
commit
375546b4ac
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user