Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Objects.World.Generators.WorldGeneratorBase Class Referenceabstract

Add some basic functionality on top of an IGenerator More...

Inheritance diagram for pluginbase.Objects.World.Generators.WorldGeneratorBase:
pluginbase.Objects.World.Generators.IWorldGenerator pluginbase.Objects.World.Generators.IBlockGenerator essentials.WorldGenerators.FlatWorld

Public Member Functions

Vector3d GetOpenPointNear (int cx, int cy, int cz, int openSize=2, int maxSearch=50)
 Search an area in the world generator for an open space near a coordinate More...
 
virtual Vector3d GetSpawn ()
 Default spawn point near 0,0,0 More...
 
virtual Vector3d GetGravity (int cx, int cy, int cz)
 Gets the direction of the gravity at a given point More...
 
abstract IBlock GetBlock (int x, int y, int z)
 Gets the type of block at a given coordinate The main engine of the world generator More...
 

Properties

string Name [get]
 Get name of the generator as defined in the attribute More...
 

Detailed Description

Add some basic functionality on top of an IGenerator

Member Function Documentation

abstract IBlock pluginbase.Objects.World.Generators.WorldGeneratorBase.GetBlock ( int  x,
int  y,
int  z 
)
pure virtual

Gets the type of block at a given coordinate The main engine of the world generator

Returns
The block.
Parameters
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.

Implements pluginbase.Objects.World.Generators.IBlockGenerator.

Implemented in essentials.WorldGenerators.FlatWorld.

virtual Vector3d pluginbase.Objects.World.Generators.WorldGeneratorBase.GetGravity ( int  cx,
int  cy,
int  cz 
)
virtual

Gets the direction of the gravity at a given point

Returns
The gravity.
Parameters
cxCx.
cyCy.
czCz.

Implements pluginbase.Objects.World.Generators.IWorldGenerator.

127  {
128  return new Vector3d(0f, 0f, -18.6f);
129  }
Vector3d pluginbase.Objects.World.Generators.WorldGeneratorBase.GetOpenPointNear ( int  cx,
int  cy,
int  cz,
int  openSize = 2,
int  maxSearch = 50 
)

Search an area in the world generator for an open space near a coordinate

Returns
The open point near.
Parameters
cxCx.
cyCy.
czCz.
openSizeOpen size.
maxSearchMax search.

Implements pluginbase.Objects.World.Generators.IWorldGenerator.

79  {
80  for (int d = 0; d < maxSearch; ++d)
81  {
82  for (int x = cx - d; x <= cx + d; ++x)
83  {
84  for (int y = cy - d; y <= cy + d; ++y)
85  {
86  for (int z=cz - d; z <= cz + d; ++z)
87  {
88 
89  if ( Math.Abs(x-cx) == d || Math.Abs(y-cy) == d || Math.Abs(z-cz) == d )
90  {
91  if (!GetBlock(x,y,z).Solid) //optimization
92  {
93  if (IsSpaceNonSolid(x,y,z,openSize))
94  {
95  return new Vector3d(x,y,z);
96  }
97  }
98  }
99 
100  }
101  }
102  }
103  }
104  //Couldn't find one, just return the position
105  return new Vector3d(cx, cy, cz);
106  }
bool Solid
Is the block solid, that is, does it have collision
Definition: IBlock.cs:188
abstract IBlock GetBlock(int x, int y, int z)
Gets the type of block at a given coordinate The main engine of the world generator ...
virtual Vector3d pluginbase.Objects.World.Generators.WorldGeneratorBase.GetSpawn ( )
virtual

Default spawn point near 0,0,0

Returns
The spawn point.

Implements pluginbase.Objects.World.Generators.IWorldGenerator.

115  {
116  return GetOpenPointNear(0,0,0);
117  }
Vector3d GetOpenPointNear(int cx, int cy, int cz, int openSize=2, int maxSearch=50)
Search an area in the world generator for an open space near a coordinate
Definition: WorldGeneratorBase.cs:78

Property Documentation

string pluginbase.Objects.World.Generators.WorldGeneratorBase.Name
get

Get name of the generator as defined in the attribute


The documentation for this class was generated from the following file: