12 #include "../Defines.h"
13 #include "../Cuboid.h"
253 cConnector
RotateMoveConnector(
const cConnector & a_Connector,
int a_NumCCWRotations,
int a_MoveX,
int a_MoveY,
int a_MoveZ)
const;
std::vector< cPiece * > cPieces
std::unique_ptr< cPlacedPiece > cPlacedPiecePtr
std::vector< cPlacedPiecePtr > cPlacedPieces
The interface that a biome generator must implement A biome generator takes chunk coords on input and...
The interface that is used to query terrain height from the shape generator.
Represents a single piece.
cVerticalStrategyPtr GetVerticalStrategy(void) const
virtual cCuboid GetHitBox(void) const =0
Returns the "hitbox" of this piece.
virtual cConnectors GetConnectors(void) const =0
Returns all of the available connectors that the piece has.
cCuboid RotateMoveHitBox(int a_NumCCWRotations, int a_MoveX, int a_MoveY, int a_MoveZ) const
Returns the hitbox after the specified number of CCW rotations and moved by the specified amounts.
cVerticalStrategyPtr m_VerticalStrategy
The strategy used for vertical placement of this piece when it is used as a starting piece.
cCuboid RotateHitBoxToConnector(const cConnector &a_MyConnector, const Vector3i &a_ToConnectorPos, int a_NumCCWRotations) const
Returns the hitbox after the specified number of rotations and moved so that a_MyConnector is placed ...
void SetVerticalStrategy(cVerticalStrategyPtr a_VerticalStrategy)
bool SetVerticalStrategyFromString(const AString &a_StrategyDesc, bool a_LogWarnings)
Sets the vertical strategy based on the description in the string.
std::shared_ptr< cVerticalLimit > cVerticalLimitPtr
cPieceModifiers m_Modifiers
The modifiers which are modifying piece's blocks.
virtual bool CanRotateCCW(int a_NumRotations) const =0
Returns true if the piece can be rotated CCW the specific number of 90-degree turns.
virtual Vector3i GetSize(void) const =0
Returns the dimensions of this piece.
cVerticalLimitPtr m_VerticalLimit
The checker that verifies each placement's vertical position.
std::shared_ptr< cVerticalStrategy > cVerticalStrategyPtr
bool SetVerticalLimitFromString(const AString &a_LimitDesc, bool a_LogWarnings)
Sets the vertical limit based on the description string.
cVerticalLimitPtr GetVerticalLimit(void) const
cPieceModifiers GetModifiers(void) const
std::shared_ptr< cPieceModifier > cPieceModifierPtr
int GetStartingPieceHeight(int a_BlockX, int a_BlockZ)
Returns the height, based on m_VerticalStrategy, for this piece when used as the starting piece.
Vector3i RotatePos(const Vector3i &a_Pos, int a_NumCCWRotations) const
Returns a copy of the a_Pos after rotating the piece the specified number of CCW rotations.
bool SetPieceModifiersFromString(const AString &a_Definition, bool a_LogWarnings)
Sets the modifiers with their params in the string.
cConnector RotateMoveConnector(const cConnector &a_Connector, int a_NumCCWRotations, int a_MoveX, int a_MoveY, int a_MoveZ) const
Returns a copy of the connector that is rotated and then moved by the specified amounts.
std::vector< cConnector > cConnectors
std::vector< cPieceModifierPtr > cPieceModifiers
cConnector(int a_X, int a_Y, int a_Z, int a_Type, eDirection a_Direction)
static int GetNumCCWRotationsToFit(eDirection a_FixedDir, eDirection a_RotatingDir)
Returns the number of CCW rotations that a_RotatingDir requires in order to be the counter-direction ...
int m_Type
Type of the connector.
static eDirection RotateDirectionCCW(eDirection a_Direction)
Returns the direction corresponding to the given direction rotated 90 degrees CCW around the Y axis.
static eDirection RotateDirection(eDirection a_Direction)
Returns the direction corresponding to the given direction rotated 180 degrees around the Y axis.
Vector3i m_Pos
Position relative to the piece.
static bool StringToDirection(const AString &a_Value, eDirection &a_Out)
Converts the string representation of a direction into the eDirection enum value.
eDirection m_Direction
Direction in which the connector is facing.
static const char * DirectionToString(eDirection a_Direction)
Returns the string representation of the direction.
static Vector3i AddDirection(const Vector3i &a_Pos, eDirection a_Direction)
Returns the position of the block that has the specified direction from the specified position.
static bool IsValidDirection(int a_Direction)
Returns true if the specified number corresponds to a valid eDirection.
static eDirection RotateDirectionCW(eDirection a_Direction)
Returns the direction corresponding to the given direction rotated 90 degrees CW around the Y axis.
Base class (interface) for strategies for placing the starting pieces vertically.
virtual ~cVerticalStrategy()
virtual bool InitializeFromString(const AString &a_Params, bool a_LogWarnings)=0
Initializes the strategy's parameters from the string representation.
virtual void AssignGens(int a_Seed, cBiomeGen &a_BiomeGen, cTerrainHeightGen &a_TerrainHeightGen, int a_SeaLevel)
Called when the piece pool is assigned to a generator, so that the strategies may bind to the underly...
virtual int GetVerticalPlacement(int a_BlockX, int a_BlockZ)=0
Returns the Y coord of the piece.
Base class (interface) for the vertical limit of piece placement.
virtual bool InitializeFromString(const AString &a_Params, bool a_LogWarnings)=0
Initializes the limit's parameters from the string representation.
virtual void AssignGens(int a_Seed, cBiomeGen &a_BiomeGen, cTerrainHeightGen &a_TerrainHeightGen, int a_SeaLevel)
Called when the piece pool is assigned to a generator, so that the limits may bind to the underlying ...
virtual bool CanBeAtHeight(int a_BlockX, int a_BlockZ, int a_Height)=0
Called to inquire whether the specified piece can be placed at the specified height.
virtual ~cVerticalLimit()
Base class (interface) for piece modifiers.
virtual void Modify(cBlockArea &a_Image, const Vector3i a_PiecePos, const int a_PieceNumRotations)=0
Called prior to writing piece to a chunk, so that modifiers can modify blocks in the blockarea.
virtual void AssignSeed(int a_Seed)
Called when the piece pool is assigned to a generator, so that the modifiers can access world seed.
virtual ~cPieceModifier()
virtual bool InitializeFromString(const AString &a_Params, bool a_LogWarnings)=0
Initializes the modifier's parameters from the string representation.
This class is an interface that stores pieces for a generator.
virtual void PiecePlaced(const cPiece &a_Piece)=0
Called after a piece is placed, to notify the pool that it has been used.
virtual int GetStartingPieceWeight(const cPiece &a_NewPiece)
Returns the relative weight with which the a_NewPiece is to be selected for placing as the first piec...
virtual int GetPieceWeight(const cPlacedPiece &a_PlacedPiece, const cPiece::cConnector &a_ExistingConnector, const cPiece &a_NewPiece)
Returns the relative weight with which the a_NewPiece is to be selected for placing under a_PlacedPie...
virtual cPieces GetStartingPieces(void)=0
Returns the pieces that should be used as the starting point.
virtual cPieces GetPiecesWithConnector(int a_ConnectorType)=0
Returns a list of pieces that contain the specified connector type.
virtual void Reset(void)=0
Called when the pool has finished the current structure and should reset any piece-counters it has fo...
Represents a single piece that has been placed to specific coords in the world.
Vector3i & GetCoords(void)
Returns the coords as a modifiable object.
const cCuboid & GetHitBox(void) const
void MoveToGroundBy(int a_OffsetY)
Moves the placed piece Y-wise by the specified offset.
cPlacedPiece(const cPlacedPiece *a_Parent, const cPiece &a_Piece, const Vector3i &a_Coords, int a_NumCCWRotations)
cPiece::cConnector GetRotatedConnector(size_t a_Index) const
Returns the connector at the specified index, rotated in the actual placement.
const cPlacedPiece * m_Parent
const Vector3i & GetCoords(void) const
const cPlacedPiece * GetParent(void) const
bool HasBeenMovedToGround(void) const
bool m_HasBeenMovedToGround
Set to true once the piece has been moved Y-wise.
int GetNumCCWRotations(void) const
const cPiece & GetPiece(void) const