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