|
static IEnumerable< IWorldBlock > | IterateBlocks (this IWorld world, Segment segment) |
| Iterate through blocks on a segment More...
|
|
static IEnumerable< IWorldBlock > | IterateBlocks (this IWorld world, Segment segment, Func< IWorldReadonlyBlock, bool > predicate) |
| Iterate through blocks on a segment which match the predicate More...
|
|
static IWorldBlock | First (this IWorld world, Segment segment, Func< IWorldReadonlyBlock, bool > predicate) |
| Find the first matching block on a segment More...
|
|
static IWorldBlock | First (this IWorld world, Segment segment, Func< IWorldReadonlyBlock, bool > predicate, int lookAhead) |
| First block along a segment, with a specified offset look-ahead More...
|
|
static IWorldBlock | BeforeFirst (this IWorld world, Segment segment, Func< IWorldReadonlyBlock, bool > predicate) |
| Find the preceeding block to the first matching block on a segment More...
|
|
static Vector3i | FindSpace (this IWorld world, Volume searchArea, Func< IWorldReadonlyBlock, bool > predicate) |
| find a space which meets the given predicate More...
|
|
static Vector3i | FindGroundedSpace (this IWorldReadonly world, Volume searchArea) |
| Search for a point where the ground below is solid, and not above (for standing) More...
|
|
static IEnumerable< Vector3i > | IterateGroundedSpace (this IWorldReadonly world, Volume search) |
| Iterate over all possible grounded space in an area More...
|
|
◆ BeforeFirst()
Find the preceeding block to the first matching block on a segment
- Parameters
-
world | World |
segment | Segment to search on |
predicate | Predicate to match blocks on |
- Returns
- The block immediately before the first matching block, or null if none are found
100 return First(world, segment, predicate, 1);
static IWorldBlock First(this IWorld world, Segment segment, Func< IWorldReadonlyBlock, bool > predicate)
Find the first matching block on a segment
Definition: WorldHelpers.cs:44
◆ FindGroundedSpace()
Search for a point where the ground below is solid, and not above (for standing)
- Returns
- The grounded space.
- Parameters
-
world | World. |
searchArea | Search area. |
Attribute: point].Solid && world[point - Vector3i.UnitZ
.Solid)
135 if (!world[point].Solid && world[point -
Vector3i.
UnitZ].Solid)
Vector3i Point
Definition: Volume.cs:12
static IEnumerable< Vector3i > IterateSpace(int w, int l, int h)
Iterates the space.
Definition: VectorIterators.cs:51
int Height
Definition: Size3i.cs:8
Size3i Size
Definition: Volume.cs:13
int Y
The Y coordinate
Definition: Vector3i.cs:23
int Width
Definition: Size3i.cs:8
A class of helpers that iterate through vector-space
Definition: VectorIterators.cs:9
static readonly Vector3i UnitZ
Vector (0,0,1)
Definition: Vector3i.cs:79
int Length
Definition: Size3i.cs:8
A class representing a 3D coordinate of integers
Definition: Vector3i.cs:13
int X
The X coordinate
Definition: Vector3i.cs:18
int Z
The Z coordinate
Definition: Vector3i.cs:28
◆ FindSpace()
find a space which meets the given predicate
- Parameters
-
world | World |
searchArea | Area to search |
predicate | Predicate to evaluate locations |
- Returns
- First location for which the predicate returns true
Attribute: point
))
115 if(predicate(world[point]))
Vector3i Point
Definition: Volume.cs:12
static IEnumerable< Vector3i > IterateSpace(int w, int l, int h)
Iterates the space.
Definition: VectorIterators.cs:51
int Height
Definition: Size3i.cs:8
Size3i Size
Definition: Volume.cs:13
int Y
The Y coordinate
Definition: Vector3i.cs:23
int Width
Definition: Size3i.cs:8
A class of helpers that iterate through vector-space
Definition: VectorIterators.cs:9
int Length
Definition: Size3i.cs:8
A class representing a 3D coordinate of integers
Definition: Vector3i.cs:13
int X
The X coordinate
Definition: Vector3i.cs:18
int Z
The Z coordinate
Definition: Vector3i.cs:28
◆ First() [1/2]
Find the first matching block on a segment
- Parameters
-
world | World |
segment | Segment to search on |
predicate | Predicate to match blocks on |
- Returns
- The first matching block, or null if none are found
Attribute: block.X, block.Y, block.Z
).FirstOrDefault(x => predicate(x));
46 return Voxels.
WalkSurfaces(segment).Select(block => world[block.X, block.Y, block.Z]).FirstOrDefault(x => predicate(x));
Helper class to work with Voxels
Definition: Voxels.cs:12
static IEnumerable< Vector3d > WalkSurfaces(Segment segment, double deltaBias=0.002)
Walks the surfaces. Returns collision point on a surface of a voxel position
Definition: Voxels.cs:33
◆ First() [2/2]
First block along a segment, with a specified offset look-ahead
- Parameters
-
world | World. |
segment | Segment. |
predicate | Predicate. |
lookAhead | The number of blocks to "look ahead" to match a selected block |
Attribute: points[i]
;
Attribute: points[i - lookAhead]
;
Attribute: points[i]
;
Attribute: points[i - lookAhead]
;
71 for (
int i=lookAhead; i<points.Length; ++i)
73 var block = world[points[i]];
75 return world[points[i - lookAhead]];
80 for (
int i=0; i<points.Length + lookAhead; ++i)
82 var block = world[points[i]];
84 return world[points[i - lookAhead]];
Helper class to work with Voxels
Definition: Voxels.cs:12
static IEnumerable< Vector3d > WalkSurfaces(Segment segment, double deltaBias=0.002)
Walks the surfaces. Returns collision point on a surface of a voxel position
Definition: Voxels.cs:33
◆ IterateBlocks() [1/2]
static IEnumerable<IWorldBlock> pluginbase.Objects.World.WorldHelpers.IterateBlocks |
( |
this IWorld |
world, |
|
|
Segment |
segment |
|
) |
| |
|
static |
Iterate through blocks on a segment
- Parameters
-
world | World |
segment | Segment to iterate on |
- Returns
- Enumeration of blocks on the segment
Attribute: block.X, block.Y, block.Z
);
Helper class to work with Voxels
Definition: Voxels.cs:12
static IEnumerable< Vector3d > WalkSurfaces(Segment segment, double deltaBias=0.002)
Walks the surfaces. Returns collision point on a surface of a voxel position
Definition: Voxels.cs:33
◆ IterateBlocks() [2/2]
Iterate through blocks on a segment which match the predicate
- Parameters
-
world | World |
segment | Segment to iterate on |
predicate | Predicate to match blocks on |
- Returns
- Enumeration of blocks on a segment which match the predicate
Attribute: block.X, block.Y, block.Z
).Where(x => predicate(x));
34 return Voxels.
WalkSurfaces(segment).Select(block => world[block.X, block.Y, block.Z]).Where(x => predicate(x));
Helper class to work with Voxels
Definition: Voxels.cs:12
static IEnumerable< Vector3d > WalkSurfaces(Segment segment, double deltaBias=0.002)
Walks the surfaces. Returns collision point on a surface of a voxel position
Definition: Voxels.cs:33
◆ IterateGroundedSpace()
Iterate over all possible grounded space in an area
- Returns
- The grounded space.
- Parameters
-
world | World. |
search | Search. |
Attribute: point].Solid && world[point - Vector3i.UnitZ
.Solid)
154 if (!world[point].Solid && world[point -
Vector3i.
UnitZ].Solid)
static IEnumerable< Vector3i > IterateVolume(this Volume vol)
Enumerates all points in a volume. If volume size=0, then no points
Definition: VectorIterators.cs:93
A class of helpers that iterate through vector-space
Definition: VectorIterators.cs:9
static readonly Vector3i UnitZ
Vector (0,0,1)
Definition: Vector3i.cs:79
A class representing a 3D coordinate of integers
Definition: Vector3i.cs:13
The documentation for this class was generated from the following file: