2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2012-09-23 22:09:57 +00:00
|
|
|
#include "Entity.h"
|
2014-06-17 03:22:17 +00:00
|
|
|
#include "EntityEffect.h"
|
2012-06-14 13:06:06 +00:00
|
|
|
|
2016-02-01 20:49:34 +00:00
|
|
|
// fwd cMonster
|
|
|
|
class cMonster;
|
|
|
|
|
2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-21 11:04:08 +00:00
|
|
|
// tolua_begin
|
2020-04-13 16:38:06 +00:00
|
|
|
class cPawn:
|
2012-12-21 11:04:08 +00:00
|
|
|
public cEntity
|
2012-12-21 12:21:20 +00:00
|
|
|
{
|
2012-12-21 11:04:08 +00:00
|
|
|
// tolua_end
|
2020-04-13 16:38:06 +00:00
|
|
|
using Super = cEntity;
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2012-06-14 13:06:06 +00:00
|
|
|
public:
|
2020-04-13 16:38:06 +00:00
|
|
|
|
2014-07-22 22:36:13 +00:00
|
|
|
CLASS_PROTODEF(cPawn)
|
2012-06-14 13:06:06 +00:00
|
|
|
|
2013-07-01 10:39:56 +00:00
|
|
|
cPawn(eEntityType a_EntityType, double a_Width, double a_Height);
|
2017-05-20 06:16:28 +00:00
|
|
|
virtual ~cPawn() override;
|
2016-02-01 20:49:34 +00:00
|
|
|
virtual void Destroyed() override;
|
|
|
|
|
2015-01-11 21:12:26 +00:00
|
|
|
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
|
2014-07-17 09:07:10 +00:00
|
|
|
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2015-10-31 15:24:45 +00:00
|
|
|
virtual bool IsFireproof(void) const override;
|
2017-08-01 17:51:43 +00:00
|
|
|
virtual bool IsInvisible() const override;
|
2015-11-01 10:50:03 +00:00
|
|
|
virtual void HandleAir(void) override;
|
2015-11-10 13:02:07 +00:00
|
|
|
virtual void HandleFalling(void);
|
|
|
|
|
2016-02-01 20:49:34 +00:00
|
|
|
/** Tells all pawns which are targeting us to stop targeting us. */
|
|
|
|
void StopEveryoneFromTargetingMe();
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-13 02:50:02 +00:00
|
|
|
// tolua_begin
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2016-07-06 10:39:56 +00:00
|
|
|
/** Applies an entity effect.
|
2014-06-13 10:47:01 +00:00
|
|
|
Checks with plugins if they allow the addition.
|
2016-07-06 10:39:56 +00:00
|
|
|
a_EffectIntensity is the level of the effect (0 = Potion I, 1 = Potion II, etc).
|
|
|
|
a_DistanceModifier is the scalar multiplied to the potion duration (only applies to splash potions).
|
2014-06-13 09:41:43 +00:00
|
|
|
*/
|
2014-07-12 00:27:29 +00:00
|
|
|
void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1);
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2016-07-06 10:39:56 +00:00
|
|
|
/** Removes a currently applied entity effect. */
|
2014-06-06 07:17:49 +00:00
|
|
|
void RemoveEntityEffect(cEntityEffect::eType a_EffectType);
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2016-07-06 10:39:56 +00:00
|
|
|
/** Returns true, if the entity effect is currently applied. */
|
2015-10-31 15:24:45 +00:00
|
|
|
bool HasEntityEffect(cEntityEffect::eType a_EffectType) const;
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2014-06-07 20:45:00 +00:00
|
|
|
/** Removes all currently applied entity effects (used when drinking milk) */
|
2014-06-13 09:04:16 +00:00
|
|
|
void ClearEntityEffects(void);
|
2015-11-10 13:02:07 +00:00
|
|
|
|
2014-06-13 02:50:02 +00:00
|
|
|
// tolua_end
|
2012-06-14 13:06:06 +00:00
|
|
|
|
2016-07-06 10:39:56 +00:00
|
|
|
/** Remove the monster from the list of monsters targeting this pawn. */
|
2016-02-01 20:49:34 +00:00
|
|
|
void NoLongerTargetingMe(cMonster * a_Monster);
|
|
|
|
|
|
|
|
/** Add the monster to the list of monsters targeting this pawn. (Does not check if already in list!) */
|
|
|
|
void TargetingMe(cMonster * a_Monster);
|
|
|
|
|
2016-11-06 18:30:19 +00:00
|
|
|
/** Returns all entity effects */
|
|
|
|
std::map<cEntityEffect::eType, cEntityEffect *> GetEntityEffects();
|
|
|
|
|
2017-08-01 17:51:43 +00:00
|
|
|
/** Returns the entity effect, if it is currently applied or nullptr if not. */
|
|
|
|
cEntityEffect * GetEntityEffect(cEntityEffect::eType a_EffectType);
|
2016-11-06 18:30:19 +00:00
|
|
|
|
2012-06-14 13:06:06 +00:00
|
|
|
protected:
|
2017-08-01 17:51:43 +00:00
|
|
|
typedef std::map<cEntityEffect::eType, std::unique_ptr<cEntityEffect>> tEffectMap;
|
2014-06-07 07:54:03 +00:00
|
|
|
tEffectMap m_EntityEffects;
|
2015-11-10 13:02:07 +00:00
|
|
|
|
|
|
|
double m_LastGroundHeight;
|
|
|
|
bool m_bTouchGround;
|
2016-02-01 20:49:34 +00:00
|
|
|
|
2018-07-23 16:26:48 +00:00
|
|
|
virtual void ResetPosition(Vector3d a_NewPosition) override;
|
|
|
|
|
2016-02-01 20:49:34 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
/** A list of all monsters that are targeting this pawn. */
|
|
|
|
std::vector<cMonster*> m_TargetingMe;
|
2013-07-01 10:39:56 +00:00
|
|
|
} ; // tolua_export
|
2012-06-14 13:06:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|