9 #include "../ClientHandle.h" 17 super(etBoat, a_Pos, 0.98, 0.7),
18 m_LastDamage(0), m_ForwardDirection(0),
19 m_DamageTaken(0.0f), m_Material(a_Material),
20 m_RightPaddleUsed(false), m_LeftPaddleUsed(false)
205 case bmOak:
return "oak";
221 if (a_Material ==
"oak")
225 else if (a_Material ==
"spruce")
229 else if (a_Material ==
"birch")
233 else if (a_Material ==
"jungle")
237 else if (a_Material ==
"acacia")
241 else if (a_Material ==
"dark_oak")
static eMaterial StringToMaterial(const AString &a_Material)
Returns the boat material for the passed string.
double GetPosY(void) const
double GetPosX(void) const
BLOCKTYPE GetBlock(Vector3i a_BlockPos)
Returns the block type at the specified position.
void SetLastDamage(int TimeSinceLastHit)
bool IsBlockWater(BLOCKTYPE a_BlockType)
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI)
Makes this entity take damage specified in the a_TDI.
void UpdatePaddles(bool rightPaddleUsed, bool leftPaddleUsed)
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
int GetLastDamage(void) const
virtual void Detach(void)
Detaches from the currently attached entity, if any.
virtual void Detach(void) override
Detaches from the currently attached entity, if any.
const Vector3d & GetSpeed(void) const
Exported in ManualBindings.
void SetMass(double a_Mass)
void SpawnItemPickups(const cItems &a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
Spawns item pickups for each item in the list.
virtual void Destroy(bool a_ShouldBroadcast=true)
Destroys the entity and schedules it for memory freeing; if a_ShouldBroadcast is set to true...
virtual bool DoTakeDamage(TakeDamageInfo &TDI) override
Makes this entity take damage specified in the a_TDI.
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
void SetMaxHealth(float a_MaxHealth)
Sets the maximum value for the health.
static cItem MaterialToItem(eMaterial a_Material)
Returns the boat item of the boat material.
Vector3d GetLookVector(void) const
static eMaterial ItemToMaterial(const cItem &a_Item)
Returns the eMaterial that should be used for a boat created from the specified item.
void Add(const cItem &a_Item)
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
void AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ)
float GetHealth(void) const
Returns the health of this entity.
void LOGWARNING(const char *a_Format, fmt::ArgList a_ArgList)
void SetGravity(float a_Gravity)
void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
Sets the speed of the entity, measured in m / sec.
virtual void OnRightClicked(cPlayer &a_Player)
Called when the specified player right-clicks this entity.
void AddSpeedY(double a_AddSpeedY)
bool IsPlayer(void) const
double GetSpeedY(void) const
virtual void AttachTo(cEntity *a_AttachTo) override
Attaches to the specified entity; detaches from any previous one first.
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override
void SendSpawnVehicle(const cEntity &a_Vehicle, char a_VehicleType, char a_VehicleSubType=0)
void SetAirDrag(float a_AirDrag)
cEntity * m_Attachee
The entity which is attached to this entity (rider), nullptr if none.
static AString MaterialToString(const eMaterial a_Material)
Returns the eMaterial as string.
double GetPosZ(void) const
void SetHealth(float a_Health)
Sets the health of this entity; doesn't broadcast any hurt animation.
#define UNREACHABLE(x)
Use to mark code that should be impossible to reach.
cBoat(Vector3d a_Pos, eMaterial a_Material)
UInt32 GetUniqueID(void) const
This class bridges a vector of cItem for safe access via Lua.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk)
virtual void BroadcastMovementUpdate(const cClientHandle *a_Exclude=nullptr)
Updates clients of changes in the entity.