Skip to content

Commit

Permalink
Merge pull request #132 from FFXIV-CombatReborn/mergeWIP2
Browse files Browse the repository at this point in the history
tiny update
  • Loading branch information
CarnifexOptimus authored Jun 13, 2024
2 parents d5a44dd + 5d1034e commit 0f890cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion BossMod/BossModule/ArenaBounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private Pathfinding.Map BuildMap()
// if rotation is 0, half-width is along X and half-height is along Z
public record class ArenaBoundsRect(float HalfWidth, float HalfHeight, Angle Rotation = default, float MapResolution = 0.5f) : ArenaBounds(CalculateRadius(HalfHeight, HalfWidth, Rotation), MapResolution)
{
private Pathfinding.Map? _cachedMap;
public readonly WDir Orientation = Rotation.ToDirection();

private static float CalculateRadius(float HalfWidth, float HalfHeight, Angle Rotation)
Expand All @@ -147,10 +148,17 @@ private static float CalculateRadius(float HalfWidth, float HalfHeight, Angle Ro
}

protected override PolygonClipper.Operand BuildClipPoly() => new(CurveApprox.Rect(Orientation, HalfWidth, HalfHeight));
public override void PathfindMap(Pathfinding.Map map, WPos center) => map.Init(MapResolution, center, HalfWidth, HalfHeight, Rotation);
public override void PathfindMap(Pathfinding.Map map, WPos center) => map.Init(_cachedMap ??= BuildMap(), center);
public override bool Contains(WDir offset) => offset.InRect(Orientation, HalfHeight, HalfHeight, HalfWidth);
public override float IntersectRay(WDir originOffset, WDir dir) => Intersect.RayRect(originOffset, dir, Orientation, HalfWidth, HalfHeight);

private Pathfinding.Map BuildMap()
{
var map = new Pathfinding.Map(MapResolution, default, HalfWidth, HalfHeight, Rotation);
map.BlockPixelsInside(ShapeDistance.InvertedRect(default, Rotation, HalfHeight, HalfHeight, HalfWidth), 0, 0);
return map;
}

public override WDir ClampToBounds(WDir offset)
{
var dx = MathF.Abs(offset.Dot(Orientation.OrthoL()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Sandblast(BossModule module) : Components.RaidwideCast(module, ActionID.Ma

class SandblastVoidzone(BossModule module) : Components.GenericAOEs(module)
{
private static readonly AOEShapeRect rect = new(19.5f, 5, 19.5f);
private static readonly AOEShapeRect rect = new(19.5f, 2.5f, 19.5f);
private readonly List<AOEInstance> _aoes = [];

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor) => _aoes;
Expand Down

0 comments on commit 0f890cd

Please sign in to comment.