< Summary

Information
Class: GridForge.Blockers.BoundsBlocker
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Blockers/BoundsBlocker.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 63
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%11100%
GetBoundsMin()100%11100%
GetBoundsMax()100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Blockers/BoundsBlocker.cs

#LineLine coverage
 1//=======================================================================
 2// BoundsBlocker.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using FixedMathSharp;
 9using FixedMathSharp.Geometry;
 10using GridForge.Grids;
 11
 12namespace GridForge.Blockers;
 13
 14/// <summary>
 15/// A manually placed blocker that obstructs a defined world-space bounding box.
 16/// </summary>
 17public class BoundsBlocker : Blocker
 18{
 19    private readonly FixedBoundBox _blockBounds;
 20
 21    /// <summary>
 22    /// Initializes a new bounds blocker bound to the supplied world.
 23    /// </summary>
 24    /// <param name="world">The world whose grids this blocker should affect.</param>
 25    /// <param name="blockBounds">The bounding box to block.</param>
 26    /// <param name="isActive">Flag whether or not blocker is active.</param>
 27    /// <param name="cacheCoveredVoxels">Flag whether or not to cache covered voxels.</param>
 28    public BoundsBlocker(
 29        GridWorld world,
 30        FixedBoundBox blockBounds,
 31        bool isActive = true,
 15132        bool cacheCoveredVoxels = false) : base(world, isActive, cacheCoveredVoxels)
 33    {
 15134        _blockBounds = blockBounds;
 15135    }
 36
 37    /// <summary>
 38    /// Initializes a new bounds blocker from world-space min/max bounds.
 39    /// </summary>
 40    /// <param name="world">The world whose grids this blocker should affect.</param>
 41    /// <param name="boundsMin">The world-space minimum bound.</param>
 42    /// <param name="boundsMax">The world-space maximum bound.</param>
 43    /// <param name="isActive">Flag whether or not blocker is active.</param>
 44    /// <param name="cacheCoveredVoxels">Flag whether or not to cache covered voxels.</param>
 45    public BoundsBlocker(
 46        GridWorld world,
 47        Vector3d boundsMin,
 48        Vector3d boundsMax,
 49        bool isActive = true,
 50        bool cacheCoveredVoxels = false)
 151        : this(
 152            world,
 153            FixedBoundBox.FromMinMax(boundsMin, boundsMax),
 154            isActive,
 155            cacheCoveredVoxels)
 156    { }
 57
 58    /// <inheritdoc cref="Blocker.GetBoundsMin"/>
 15859    protected override Vector3d GetBoundsMin() => _blockBounds.Min;
 60
 61    /// <inheritdoc cref="Blocker.GetBoundsMax"/>
 15862    protected override Vector3d GetBoundsMax() => _blockBounds.Max;
 63}