public void SetBlockMaskAt(SegmentLocation segmentLocation, BlockMask blockMask)
        {
            if (IsLocationInRange(segmentLocation))
            {
                // can't place block on obstructed air as its an item!
                if (GetBlockMaskAt(segmentLocation) == BlockHelper.BlockMasks.AirBlocked)
                {
                    return;
                }

                // can't delete block with item above it!
                if (blockMask == BlockHelper.BlockMasks.Air)
                {
                    if (GetBlockMaskAt(segmentLocation.TranslateAndClone(new Vector3(0, 1, 0))) ==
                        BlockHelper.BlockMasks.AirBlocked)
                    {
                        return;
                    }
                }

                GetRenderSegmentAt(segmentLocation).Blocks[
                    segmentLocation.BlockX, segmentLocation.RenderSegmentBlockMaskIndex, segmentLocation.BlockZ] =
                    blockMask;

                // Mark all around it as dirty.
                SetLocationDirty(segmentLocation);
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.Up));
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.Down));
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.North));
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.East));
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.South));
                SetLocationDirty(segmentLocation.TranslateAndClone(WorldDirection.West));
            }
        }
        public bool IsLocationWalkable(SegmentLocation segmentLocation)
        {
            if (IsLocationInRange(segmentLocation))
            {
                if (IsLocationObstructed(segmentLocation))
                {
                    return(false);
                }

                BlockMask blockBelow = GetBlockMaskAt(segmentLocation.TranslateAndClone(WorldDirection.Down));

                if (BlockHelper.IsBlock(blockBelow) || BlockHelper.HasTopRamp(blockBelow))
                {
                    return(true);
                }
            }

            return(false);
        }