2013-09-07 19:14:57 -04:00
|
|
|
|
|
|
|
// Boat.h
|
|
|
|
|
2013-09-08 11:56:16 -04:00
|
|
|
// Declares the cBoat class representing a boat in the world
|
2013-09-07 19:14:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Entity.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-05-09 08:21:25 -04:00
|
|
|
// tolua_begin
|
2013-09-07 19:14:57 -04:00
|
|
|
|
2020-04-13 12:38:06 -04:00
|
|
|
class cBoat:
|
2013-09-07 19:14:57 -04:00
|
|
|
public cEntity
|
|
|
|
{
|
2020-04-13 12:38:06 -04:00
|
|
|
// tolua_end
|
|
|
|
|
|
|
|
using Super = cEntity;
|
|
|
|
|
|
|
|
// tolua_begin
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2013-09-07 19:14:57 -04:00
|
|
|
public:
|
2017-05-09 08:21:25 -04:00
|
|
|
enum eMaterial
|
|
|
|
{
|
|
|
|
bmOak,
|
|
|
|
bmSpruce,
|
|
|
|
bmBirch,
|
|
|
|
bmJungle,
|
|
|
|
bmAcacia,
|
|
|
|
bmDarkOak
|
|
|
|
};
|
|
|
|
|
|
|
|
// tolua_end
|
|
|
|
|
2014-07-22 18:36:13 -04:00
|
|
|
CLASS_PROTODEF(cBoat)
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2019-09-29 08:59:24 -04:00
|
|
|
cBoat(Vector3d a_Pos, eMaterial a_Material);
|
|
|
|
|
2013-09-07 19:14:57 -04:00
|
|
|
// cEntity overrides:
|
|
|
|
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
2020-03-07 06:56:02 -05:00
|
|
|
virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = nullptr) override;
|
2013-09-07 19:14:57 -04:00
|
|
|
virtual void OnRightClicked(cPlayer & a_Player) override;
|
2014-04-25 18:32:30 -04:00
|
|
|
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
|
2015-01-11 16:12:26 -05:00
|
|
|
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
2013-12-16 12:03:39 -05:00
|
|
|
virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways) override;
|
2021-04-30 07:39:10 -04:00
|
|
|
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
2016-02-05 16:45:45 -05:00
|
|
|
|
2016-07-18 16:10:00 -04:00
|
|
|
int GetLastDamage(void) const { return m_LastDamage; }
|
|
|
|
int GetForwardDirection(void) const { return m_ForwardDirection; }
|
|
|
|
|
|
|
|
float GetDamageTaken(void) const { return m_DamageTaken; }
|
|
|
|
|
2017-05-09 08:21:25 -04:00
|
|
|
// tolua_begin
|
|
|
|
|
|
|
|
/** Returns the eMaterial of the boat */
|
|
|
|
eMaterial GetMaterial(void) const { return m_Material; }
|
|
|
|
|
|
|
|
/** Sets the eMaterial of the boat */
|
|
|
|
void SetMaterial(cBoat::eMaterial a_Material) { m_Material = a_Material; }
|
|
|
|
|
|
|
|
/** Returns the eMaterial that should be used for a boat created from the specified item. Returns bmOak if not a boat item */
|
|
|
|
static eMaterial ItemToMaterial(const cItem & a_Item);
|
|
|
|
|
|
|
|
/** Returns the boat item of the boat material */
|
|
|
|
static cItem MaterialToItem(eMaterial a_Material);
|
|
|
|
|
|
|
|
/** Returns the eMaterial as string */
|
|
|
|
static AString MaterialToString(const eMaterial a_Material);
|
|
|
|
|
|
|
|
/** Returns the boat material for the passed string. Returns oak if not valid */
|
|
|
|
static eMaterial StringToMaterial(const AString & a_Material);
|
|
|
|
|
|
|
|
// tolua_end
|
2016-07-18 16:10:00 -04:00
|
|
|
|
|
|
|
bool IsRightPaddleUsed(void) const { return m_RightPaddleUsed; }
|
|
|
|
bool IsLeftPaddleUsed(void) const { return m_LeftPaddleUsed; }
|
2013-09-09 05:13:14 -04:00
|
|
|
|
2016-07-18 16:10:00 -04:00
|
|
|
void SetLastDamage(int TimeSinceLastHit);
|
2013-09-09 05:13:14 -04:00
|
|
|
|
2016-07-18 16:10:00 -04:00
|
|
|
void UpdatePaddles(bool rightPaddleUsed, bool leftPaddleUsed);
|
|
|
|
private:
|
|
|
|
int m_LastDamage;
|
|
|
|
int m_ForwardDirection;
|
|
|
|
|
|
|
|
float m_DamageTaken;
|
|
|
|
|
2017-05-09 08:21:25 -04:00
|
|
|
eMaterial m_Material;
|
2016-07-18 16:10:00 -04:00
|
|
|
|
|
|
|
bool m_RightPaddleUsed;
|
|
|
|
bool m_LeftPaddleUsed;
|
2017-05-09 08:21:25 -04:00
|
|
|
} ; // tolua_export
|