Fix distance logic for gathering nodes
This commit is contained in:
parent
ffc24b246b
commit
606b9d52ba
@ -219,8 +219,8 @@ public sealed class RendererPlugin : IDalamudPlugin
|
|||||||
refY = x.Position.Z,
|
refY = x.Position.Z,
|
||||||
refZ = x.Position.Y,
|
refZ = x.Position.Y,
|
||||||
Filled = true,
|
Filled = true,
|
||||||
radius = x.CalculateMinimumDistance(),
|
radius = locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance(),
|
||||||
Donut = x.CalculateMaximumDistance() - x.CalculateMinimumDistance(),
|
Donut = (locationOverride?.MaximumDistance ?? x.CalculateMaximumDistance()) - (locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance()),
|
||||||
color = _colors[location.Root.Groups.IndexOf(group) % _colors.Count],
|
color = _colors[location.Root.Groups.IndexOf(group) % _colors.Count],
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
coneAngleMin = minimumAngle,
|
coneAngleMin = minimumAngle,
|
||||||
|
@ -89,7 +89,8 @@ internal sealed class EditorWindow : Window
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_target ??= _objectTable.Where(x => x.ObjectKind == ObjectKind.GatheringPoint && x.DataId == location.Node.DataId)
|
_target ??= _objectTable
|
||||||
|
.Where(x => x.ObjectKind == ObjectKind.GatheringPoint && x.DataId == location.Node.DataId)
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Object = x,
|
Object = x,
|
||||||
@ -129,18 +130,20 @@ internal sealed class EditorWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
int minAngle = locationOverride.MinimumAngle ?? location.MinimumAngle.GetValueOrDefault();
|
int minAngle = locationOverride.MinimumAngle ?? location.MinimumAngle.GetValueOrDefault();
|
||||||
if (ImGui.DragInt("Min Angle", ref minAngle, 5, -360, 360))
|
int maxAngle = locationOverride.MaximumAngle ?? location.MaximumAngle.GetValueOrDefault();
|
||||||
|
if (ImGui.DragIntRange2("Angle", ref minAngle, ref maxAngle, 5, -360, 360))
|
||||||
{
|
{
|
||||||
locationOverride.MinimumAngle = minAngle;
|
locationOverride.MinimumAngle = minAngle;
|
||||||
locationOverride.MaximumAngle ??= location.MaximumAngle.GetValueOrDefault();
|
locationOverride.MaximumAngle = maxAngle;
|
||||||
_plugin.Redraw();
|
_plugin.Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxAngle = locationOverride.MaximumAngle ?? location.MaximumAngle.GetValueOrDefault();
|
float minDistance = locationOverride.MinimumDistance ?? location.CalculateMinimumDistance();
|
||||||
if (ImGui.DragInt("Max Angle", ref maxAngle, 5, -360, 360))
|
float maxDistance = locationOverride.MaximumDistance ?? location.CalculateMaximumDistance();
|
||||||
|
if (ImGui.DragFloatRange2("Distance", ref minDistance, ref maxDistance, 0.1f, 1f, 3f))
|
||||||
{
|
{
|
||||||
locationOverride.MinimumAngle ??= location.MinimumAngle.GetValueOrDefault();
|
locationOverride.MinimumDistance = minDistance;
|
||||||
locationOverride.MaximumAngle = maxAngle;
|
locationOverride.MaximumDistance = maxDistance;
|
||||||
_plugin.Redraw();
|
_plugin.Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,8 +153,18 @@ internal sealed class EditorWindow : Window
|
|||||||
ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DalamudRed);
|
ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DalamudRed);
|
||||||
if (ImGui.Button("Save"))
|
if (ImGui.Button("Save"))
|
||||||
{
|
{
|
||||||
location.MinimumAngle = locationOverride.MinimumAngle;
|
if (locationOverride is { MinimumAngle: not null, MaximumAngle: not null })
|
||||||
location.MaximumAngle = locationOverride.MaximumAngle;
|
{
|
||||||
|
location.MinimumAngle = locationOverride.MinimumAngle ?? location.MinimumAngle;
|
||||||
|
location.MaximumAngle = locationOverride.MaximumAngle ?? location.MaximumAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (locationOverride is { MinimumDistance: not null, MaximumDistance: not null })
|
||||||
|
{
|
||||||
|
location.MinimumDistance = locationOverride.MinimumDistance;
|
||||||
|
location.MaximumDistance = locationOverride.MaximumDistance;
|
||||||
|
}
|
||||||
|
|
||||||
_plugin.Save(context.File, context.Root);
|
_plugin.Save(context.File, context.Root);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +256,6 @@ internal sealed class LocationOverride
|
|||||||
|
|
||||||
public bool NeedsSave()
|
public bool NeedsSave()
|
||||||
{
|
{
|
||||||
return MinimumAngle != null && MaximumAngle != null;
|
return (MinimumAngle != null && MaximumAngle != null) || (MinimumDistance != null && MaximumDistance != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
"[Kugane] Aetheryte Plaza",
|
"[Kugane] Aetheryte Plaza",
|
||||||
"[Kugane] The Ruby Price"
|
"[Kugane] The Ruby Price"
|
||||||
],
|
],
|
||||||
|
"FlyBetweenNodes": true,
|
||||||
"Groups": [
|
"Groups": [
|
||||||
{
|
{
|
||||||
"Nodes": [
|
"Nodes": [
|
||||||
@ -33,8 +34,10 @@
|
|||||||
"Y": 0.503479,
|
"Y": 0.503479,
|
||||||
"Z": 634.821
|
"Z": 634.821
|
||||||
},
|
},
|
||||||
"MinimumAngle": 60,
|
"MinimumAngle": 45,
|
||||||
"MaximumAngle": 150
|
"MaximumAngle": 90,
|
||||||
|
"MinimumDistance": 1.6,
|
||||||
|
"MaximumDistance": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Position": {
|
"Position": {
|
||||||
@ -132,4 +135,4 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -19,8 +19,9 @@ public static class GatheringMath
|
|||||||
degrees = Rng.Next(0, 360);
|
degrees = Rng.Next(0, 360);
|
||||||
|
|
||||||
float range = Rng.Next(
|
float range = Rng.Next(
|
||||||
(int)(location.CalculateMinimumDistance() * 100),
|
(int)(location.CalculateMinimumDistance() * 100),
|
||||||
(int)((location.CalculateMaximumDistance() - location.CalculateMinimumDistance()) * 100)) / 100f;
|
(int)(location.CalculateMaximumDistance() * 100))
|
||||||
|
/ 100f;
|
||||||
return (CalculateLandingLocation(location.Position, degrees, range), degrees, range);
|
return (CalculateLandingLocation(location.Position, degrees, range), degrees, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user