8 #include "../Blocks/BlockHandler.h"
9 #include "../Blocks/BlockInfested.h"
16 Super(
"Silverfish",
mtSilverfish,
"entity.silverfish.hurt",
"entity.silverfish.death",
"entity.silverfish.ambient", 0.4f, 0.3f)
60 const auto Block = Position + Offset;
64 return Random.RandBool();
71 for (
int CubeSideLength = 3; CubeSideLength <= 10; CubeSideLength += 2)
73 const int HalfSide = CubeSideLength / 2;
75 for (
int OffsetX = -HalfSide; OffsetX <= HalfSide; OffsetX++)
77 for (
int OffsetZ = -HalfSide; OffsetZ <= HalfSide; OffsetZ++)
79 if (CheckInfested({ OffsetX, +HalfSide, OffsetZ }) || CheckInfested({ OffsetX, -HalfSide, OffsetZ }))
86 for (
int OffsetX = -HalfSide; OffsetX <= HalfSide; OffsetX++)
88 for (
int OffsetY = -HalfSide + 1; OffsetY <= HalfSide - 1; OffsetY++)
90 if (CheckInfested({ OffsetX, OffsetY, +HalfSide }) || CheckInfested({ OffsetX, OffsetY, -HalfSide }))
97 for (
int OffsetZ = -HalfSide + 1; OffsetZ <= HalfSide - 1; OffsetZ++)
99 for (
int OffsetY = -HalfSide + 1; OffsetY <= HalfSide - 1; OffsetY++)
101 if (CheckInfested({ +HalfSide, OffsetY, OffsetZ }) || CheckInfested({ -HalfSide, OffsetY, OffsetZ }))
MTRand & GetRandomProvider()
Returns the current thread's random number source.
bool IsPlayer(void) const
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
Vector3< int > Floor(void) const
Returns a new Vector3i with coords set to std::floor() of this vector's coords.
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
bool DigBlock(Vector3i a_BlockPos, const cEntity *a_Digger=nullptr)
Replaces the specified block with air, and calls the OnBroken block handler.