1
0
Fork 0
cuberite-2a/src/Entities/ExpOrb.h

56 lines
1.2 KiB
C
Raw Normal View History

2013-11-25 19:05:52 +00:00
#pragma once
#include "Entity.h"
2014-03-14 23:43:38 +00:00
// tolua_begin
2020-04-13 16:38:06 +00:00
class cExpOrb:
2013-11-25 19:05:52 +00:00
public cEntity
{
2014-03-14 23:43:38 +00:00
// tolua_end
2020-04-13 16:38:06 +00:00
using Super = cEntity;
public: // tolua_export
CLASS_PROTODEF(cExpOrb)
2014-03-14 23:43:38 +00:00
cExpOrb(Vector3d a_Pos, int a_Reward);
2013-11-25 19:05:52 +00:00
// Override functions
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
2013-11-25 19:05:52 +00:00
virtual void SpawnOn(cClientHandle & a_Client) override;
2014-03-14 23:43:38 +00:00
// tolua_begin
2014-03-14 23:32:49 +00:00
/** Returns the number of ticks that this entity has existed */
int GetAge(void) const { return std::chrono::duration_cast<cTickTime>(m_Timer).count(); }
2014-03-14 23:43:38 +00:00
2014-03-14 23:32:49 +00:00
/** Set the number of ticks that this entity has existed */
void SetAge(int a_Age) { m_Timer = cTickTime(a_Age); }
2013-11-25 19:05:52 +00:00
2014-03-14 23:32:49 +00:00
/** Get the exp amount */
int GetReward(void) const { return m_Reward; }
2014-03-14 23:43:38 +00:00
2014-03-14 23:32:49 +00:00
/** Set the exp amount */
void SetReward(int a_Reward) { m_Reward = a_Reward; }
// tolua_end
2013-11-25 19:05:52 +00:00
/** Split reward into small values according to regular Minecraft rules */
static std::vector<int> Split(int a_Reward);
2013-11-25 19:05:52 +00:00
protected:
int m_Reward;
2016-02-05 21:45:45 +00:00
2014-03-14 23:32:49 +00:00
/** The number of ticks that the entity has existed / timer between collect and destroy; in msec */
2015-01-16 13:27:10 +00:00
std::chrono::milliseconds m_Timer;
} ; // tolua_export