Don't show window if between areas
This commit is contained in:
parent
a0e7687b58
commit
375546b4ac
@ -32,14 +32,20 @@ partial class WorkshopPlugin
|
||||
|
||||
private float GetDistanceToEventObject(IReadOnlyList<uint> npcIds, out GameObject? o)
|
||||
{
|
||||
foreach (var obj in _objectTable)
|
||||
Vector3? localPlayerPosition = _clientState.LocalPlayer?.Position;
|
||||
if (localPlayerPosition != null)
|
||||
{
|
||||
if (obj.ObjectKind == ObjectKind.EventObj)
|
||||
foreach (var obj in _objectTable)
|
||||
{
|
||||
if (npcIds.Contains(GetNpcId(obj)))
|
||||
if (obj.ObjectKind == ObjectKind.EventObj)
|
||||
{
|
||||
o = obj;
|
||||
return Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, obj.Position + new Vector3(0, -2, 0));
|
||||
if (npcIds.Contains(GetNpcId(obj)))
|
||||
{
|
||||
o = obj;
|
||||
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