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,
|
||||
refZ = x.Position.Y,
|
||||
Filled = true,
|
||||
radius = x.CalculateMinimumDistance(),
|
||||
Donut = x.CalculateMaximumDistance() - x.CalculateMinimumDistance(),
|
||||
radius = locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance(),
|
||||
Donut = (locationOverride?.MaximumDistance ?? x.CalculateMaximumDistance()) - (locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance()),
|
||||
color = _colors[location.Root.Groups.IndexOf(group) % _colors.Count],
|
||||
Enabled = true,
|
||||
coneAngleMin = minimumAngle,
|
||||
|
@ -89,7 +89,8 @@ internal sealed class EditorWindow : Window
|
||||
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
|
||||
{
|
||||
Object = x,
|
||||
@ -129,18 +130,20 @@ internal sealed class EditorWindow : Window
|
||||
}
|
||||
|
||||
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.MaximumAngle ??= location.MaximumAngle.GetValueOrDefault();
|
||||
locationOverride.MaximumAngle = maxAngle;
|
||||
_plugin.Redraw();
|
||||
}
|
||||
|
||||
int maxAngle = locationOverride.MaximumAngle ?? location.MaximumAngle.GetValueOrDefault();
|
||||
if (ImGui.DragInt("Max Angle", ref maxAngle, 5, -360, 360))
|
||||
float minDistance = locationOverride.MinimumDistance ?? location.CalculateMinimumDistance();
|
||||
float maxDistance = locationOverride.MaximumDistance ?? location.CalculateMaximumDistance();
|
||||
if (ImGui.DragFloatRange2("Distance", ref minDistance, ref maxDistance, 0.1f, 1f, 3f))
|
||||
{
|
||||
locationOverride.MinimumAngle ??= location.MinimumAngle.GetValueOrDefault();
|
||||
locationOverride.MaximumAngle = maxAngle;
|
||||
locationOverride.MinimumDistance = minDistance;
|
||||
locationOverride.MaximumDistance = maxDistance;
|
||||
_plugin.Redraw();
|
||||
}
|
||||
|
||||
@ -150,8 +153,18 @@ internal sealed class EditorWindow : Window
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DalamudRed);
|
||||
if (ImGui.Button("Save"))
|
||||
{
|
||||
location.MinimumAngle = locationOverride.MinimumAngle;
|
||||
location.MaximumAngle = locationOverride.MaximumAngle;
|
||||
if (locationOverride is { MinimumAngle: not null, MaximumAngle: not null })
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -243,6 +256,6 @@ internal sealed class LocationOverride
|
||||
|
||||
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] The Ruby Price"
|
||||
],
|
||||
"FlyBetweenNodes": true,
|
||||
"Groups": [
|
||||
{
|
||||
"Nodes": [
|
||||
@ -33,8 +34,10 @@
|
||||
"Y": 0.503479,
|
||||
"Z": 634.821
|
||||
},
|
||||
"MinimumAngle": 60,
|
||||
"MaximumAngle": 150
|
||||
"MinimumAngle": 45,
|
||||
"MaximumAngle": 90,
|
||||
"MinimumDistance": 1.6,
|
||||
"MaximumDistance": 3
|
||||
},
|
||||
{
|
||||
"Position": {
|
||||
|
@ -20,7 +20,8 @@ public static class GatheringMath
|
||||
|
||||
float range = Rng.Next(
|
||||
(int)(location.CalculateMinimumDistance() * 100),
|
||||
(int)((location.CalculateMaximumDistance() - location.CalculateMinimumDistance()) * 100)) / 100f;
|
||||
(int)(location.CalculateMaximumDistance() * 100))
|
||||
/ 100f;
|
||||
return (CalculateLandingLocation(location.Position, degrees, range), degrees, range);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user